程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> 關於JAVA >> A problem when connect MSSQL with transaction.

A problem when connect MSSQL with transaction.

編輯:關於JAVA

Problem: Could not load object: [Microsoft][SQL(SQL Server培訓 MySQL培訓 )Server 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode. ===============================================

Solve:

If you pass "SelectMethod=cursor" attribute in connectio url, will allow more than one active statement per connection." jdbc:microsoft:sqlserver://localhost:1433;SelectMethod=cursor;","user","pwd"The reason for this is;When SelectMethod is set to direct, SQL Server does not support multiple active statements on a single connection within a transaction; however, when auto-commit mode is enabled (the default), the Microsoft SQL Server JDBC driver provides the ability to have multiple JDBC statements open on a single JDBC connection. This is done by cloning physical SQL Server connections as needed. To avoid cloning physical SQL Server connections in this circumstance, you should create only one Statement, PreparedStatement, CallableStatement, or DatabaseMetaData object per JDBC Connection object. Be sure to invoke the "close" methods on these objects when you are finished with them, that is, before creating another object of the types described.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved