java.sql.SQLException: Could not commit with auto-commit set on

 

This kind of exceptions occur when the Oracle JDBC Driver (ojdbc6.jar) version 12 or above will be used. Version 12 and above of the driver is more strictly than earlier driver versions.

You can solve the problem, you have few options:

  1. Change jar file to old version.( Below 12; usually issue occurs while migrating to new server)
  2. Override behavior of new jar version(ojdbc6.jar) with setting below JVM arguments.

    -Doracle.jdbc.autoCommitSpecCompliant=false

     

  3. Set Auto Commit off in Java/SQL:

    Java:

    conn.setAutoCommit(false);

    Oracle:

    SET AUTOCOMMIT OFF

 

其中 第二个方法 被证实有效。

 

参考 http://stackoverflow.com/questions/23953534/java-sql-sqlexception-could-not-commit-with-auto-commit-set-on-at-oracle-jdbc-d

posted on 2017-03-30 13:06  迷茫中寻找方向  阅读(2098)  评论(0编辑  收藏  举报

导航