Topic: Exception:cannot start a cloned connection while in manual transaction

  Print this page

1.Exception:cannot start a cloned connection while in manual transaction Copy to clipboard
Posted by: k_k_grass
Posted on: 2003-04-29 23:21

使用findByPrimaryKey(pk)查询CMP/Weblogic 7.0,出现
EJB exception ;nested exception is :java.sql.SQLException ;[Micorsoft][SQLServer 2000 driver for jdbc] cannot start a cloned connection while in manual transaction
多谢指教!

2.Re:Exception:cannot start a cloned connection while in manual transaction [Re: k_k_grass] Copy to clipboard
Posted by: why
Posted on: 2003-04-29 23:36

use the connection property "SelectMethod", e.g.
jdbc:microsoft:sqlserver://dbmachine:1433;SelectMethod=cursor

from http://ad2.arip.co.th/Help/jdbcsqlsrv3.html :

SelectMethod={cursor | direct}. Determines whether database cursors are used for Select statements. Performance and behavior of the driver are affected by the SelectMethod setting.

Direct-The direct method sends the complete result set in one request to the driver. It is useful for queries that only produce a small amount of data that you fetch completely. You should avoid using direct when executing queries that produce a large amount of data, as the result set is cached completely on the client and constrains memory. In this mode, each statement requires its own connection to the database. This is accomplished by "cloning" connections. Cloned connections use the same connection properties as the original connection; however, because transactions must occur on a single connection, auto commit mode is required. Due to this, JTA is not supported in direct mode. In addition, some operations, such as updating an insensitive result set, are not supported in direct mode because the driver must create a second statement internally. Exceptions generated due to the creation of cloned statements usually return an error message similar to "Cannot start a cloned connection while in manual transaction mode."

Cursor-When the SelectMethod is set to cursor, a server-side cursor is generated. The rows are fetched from the server in blocks. The JDBC Statement method setFetchSize can be used to control the number of rows that are fetched per request. The cursor method is useful for queries that produce a large amount of data, data that is too large to cache on the client. Performance tests show that the value of setFetchSize has a serious impact on performance when SelectMethod is set to cursor. There is no simple rule for determining the value that you should use. You should experiment with different setFetchSize values to find out which value gives the best performance for your application.

3.Re:Exception:cannot start a cloned connection while in manual transaction [Re: k_k_grass] Copy to clipboard
Posted by: k_k_grass
Posted on: 2003-04-30 16:53

why,that is very clear,tks a lot!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923