`
zjx2388
  • 浏览: 1337100 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

Can't start a cloned connection while in manual transaction mode.错误的解决方案

    博客分类:
  • J2EE
阅读更多

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.setupImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.<init>(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.<init>(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Source)
at com.capitel.telecom.tobacco.dao.TightsmokeDAO.insertTightsmokeInfo(TightsmokeDAO.java:57)
at com.capitel.telecom.tobacco.logic.DataMaintainManager.tightsmokeAdd(DataMaintainManager.java:616)

。。。。。。。。。。

上面是从mysql数据库升级到SQL Server数据库时,第一次报的错误

从网上找了一些解决方案,先PS在下面:

--------------------------------------------------------------------------------------------------------------------------------
解决方案:(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;SelectMethod=cursor;问题解决。

---------------------------------------------感觉比较有理由的下面的这个说法------------------------------------------------
原因一般是当你在一个SQL SERVER的JDBC连接上执行多个STATEMENTS的操作,或者是手动事务状态(AutoCommit=false) 并且使用默认的模式. direct (SelectMethod=direct) 模式.

解决办法
当你使用手动事务模式时,必须把SelectMethod 属性的值设置为 Cursor, 或者是确保在你的连接只有一个STATEMENT操作。

修改url

加入SelectMethod=cursor即可

总结一下:

我也只在连接数据库的URL后面添加了一段SelectMethod=cursor;就可以正常使用了

分享到:
评论

相关推荐

    sqlserver2000事务问题.txt

    例如,在手动事务模式下尝试克隆连接可能会导致异常,如文中提到的“Can't start a cloned connection while in manual transaction mode”。 - **问题原因**:在手动事务模式下,如果尝试克隆连接,会导致这种类型...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: In "Windows ClearType" font rendering mode (OS Windows mode) the "garbage" pixels can appear from the right and from the bottom sides of the painted rectangle of the TFlexText object....

    DataCloneError(解决方案).md

    DataCloneError(解决方案)

    tweenjs.min.js文件

    a._setPaused=function(a){return createjs.Tween._register(this,a),this},a.setPaused=createjs.deprecate(a._setPaused,"AbstractTween.setPaused"),a._getPaused=function(){return this._paused},a.getPaused=...

    NewSID(光学习一下代码就可以了,没看清楚介绍别运行)

    Ghost Software and Altiris to develop programs that can change a computer‘s SID after a system has been cloned. However, PowerQuest‘s SID Changer and Ghost Software‘s Ghost Walker are only sold as...

    Removing Credentials from a Cloned EBS Production Database (Doc

    Removing Credentials from a Cloned EBS Production Database (Doc ID 419475.1)

    MapReduce-based Assembly Clone Search for Reverse Engineering.pdf

    A paper published in 2016. ABSTRACT Assembly code analysis is one of the critical processes for detecting and proving software plagiarism and software patent infringements when the source code is ...

    Delphi7.1 Update

    and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized ...

    Object-Oriented Analysis and Design 第六章

    In a web application, for instance, having a singleton database connection manager can help manage and control connections efficiently, ensuring that there's only one central authority for managing ...

    SQL_Assistant_9.5.469_Enterprise_Edition 破解

    SA0033310 - Cloned connections don't always work correctly. SA0033327 - $$...$$ macro usage with SQL Server environments, in certain cases may trigger multiple executions of the same macro. SA...

    How to Detect Cloned Tags in a Reliable Way

    RFID(射频识别)技术是无线通讯技术的一种,它可以用于追踪和识别物理对象。...这些方向的研究将有助于开发出更全面、更鲁棒的RFID克隆标签检测解决方案,为各种需要RFID技术的应用提供更高级别的安全保障。

    Rust - Rust Programming By Example - Guillaume Gomez

    - **Clone Types:** Types that implement the `Clone` trait can be cloned, creating a new owned value. - **Copy Types:** Types that implement the `Copy` trait can be copied directly into another ...

    Y Combinator W21 Demo Day (Cloned on 4_29_2021).pdf

    这些初创公司通过创新的解决方案和商业模式吸引了大量的风险资本,预示着未来科技行业的繁荣和潜力。同时,投资者对这些初创公司的投资反映了他们对新兴技术和创新业务模式的信任,以及对未来的乐观预期。

    complete-user-auth:针对任何以Express.js和MongoDB为后端的应用程序的完整且易于集成的User-Authentication REST API

    3. Run npm install in cloned directory 4. Start MongoDB service in your machine 5. Change the connection string of DB in db/db.js 5. Start the app by running npm run dev and open POSTMAN. 6. Start ...

    Android代码-HoloIRC

    What is HoloIRC? HoloIRC is an open source IRC client for Android....A directory called libraries should be created inside the cloned folder https://github.com/tilal6991/Relay should be cloned into a f

    easeljs1.0.0源码

    goto(a)},b.getLabels=function(){return this.timeline.getLabels()},b.getCurrentLabel=function(){return this._updateTimeline(),this.timeline.getCurrentLabel()},b.clone=function(){throw"MovieClip cannot ...

    myasm51,小型的51单片机汇编器源码

    in text file (assembly language source) into a machine executable object file. During the first pass, the assembler builds a symbol table from the symbols and labels used in the source file. In the ...

    visual assist 10.5.1707

    The text caret is placed in the correct location after accepting a .NET Generic from a suggestion list in VB 2008. (case=20259) 8257 When typing a parameter in a C# LINQ predicate function, focus is ...

    myasm51-51单片机汇编器源码

    in text file (assembly language source) into a machine executable object file. During the first pass, the assembler builds a symbol table from the symbols and labels used in the source file. In the ...

    OSError: Looks like you do not have git-lfs installed【没有root权限】

    LFS是Large File Storage的缩写,用了帮助git管理大的文件 原理:不同于git每次保存diff,对于git来说,如果是模型或者一些设计大文件,改变一点,对于仓库来说会增加很大的体积,不一会就能几个G。...

Global site tag (gtag.js) - Google Analytics