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

java.sql.SQLException: Could not commit with auto-commit set on  
        at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:2356)  
        at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:2403)  
        at com.mchange.v2.c3p0.impl.NewProxyConnection.commit(NewProxyConnection.java:803)  
        at com.abc.boeing.bjs.agentservice.batch.framework.BatchProc.batchOver(BatchProc.java:200)  
        at com.abc.omip.bjs.common.BaseMapBatch.executeBatch(BaseMapBatch.java:112)  
        at com.abc.boeing.bjs.agentservice.batch.runtime.ThreadBatchLaunch.executeBatch(ThreadBatchLaunch.java:64)  
        at com.abc.boeing.bjs.agentservice.batch.runtime.BaseBatchLaunch.run(BaseBatchLaunch.java:102)  
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)  
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)  

        at java.lang.Thread.run(Thread.java:785) 

解决方法:本人原来用的驱动是 ojdbc6-12.1.0.2.0.19120445.jar 报上面错误,换成ojdbc5_g.jar 即可解决上面问题

思路来自:

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

    IBM WAS users, refer this link:

  3. Set Auto Commit off in Java/SQL:

    Java:

    conn.setAutoCommit(false);

    Oracle:

    SET AUTOCOMMIT OFF



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


猜你喜欢

转载自blog.csdn.net/ningfuxuan/article/details/80209137