Can't start a cloned connection while in manual transaction mode

 

解决方案:(1)

你在尝试打开一个克隆连接,有两种解决办法: 每个数据库的连接在执行完毕后,关闭,第二,在连接时,判断是否已经有连接存在,有则使用现成的连接。 数据库连接可以设置成一个常量,不需要到处定义。便于维护。

解决方案:(2)

你在DatabaseURL字符串中加入SelectMethod=Cursor;如下
jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=Partner;SelectMethod=Cursor;

###################################其他参考##############################

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.Sridhar PaladuguMicrosoft Developer SupportJDBC Webdata


是因为commit设置为false了,查资料,对URL做修改:jdbc:microsoft:sqlserver://localhost:1433;user=test;password=secret;<u><font color="#ff1493">SelectMethod=cursor</font>;</u>问题解决。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值