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












9















I just upgrade to new jdbc driver from classes12.jar to ojdbc7.jar



My app threw an exception when was running with ojdbc7.jar:



java.sql.SQLException: Could not commit with auto-commit set on
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:4443)
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:4490)
at oracle.jdbc.driver.T4CConnection.doSetAutoCommit(T4CConnection.java:943)
at oracle.jdbc.driver.PhysicalConnection.setAutoCommit(PhysicalConnection.java:4


My app still run normally with classes12.jar.



I researched on oracle:



This exception is raised for any one of the following cases:




  • When auto-commit status is set to true and commit or rollback method is called

  • When the default status of auto-commit is not changed and commit or rollback method is called

  • When the value of the COMMIT_ON_ACCEPT_CHANGES property is true and commit or rollback method is called after calling the acceptChanges method on a rowset


But i couldn't find mistake in my source. Please help me give more explaination about this error.










share|improve this question




















  • 1





    Try setting connection.setAutoCommit(false);

    – user432
    May 30 '14 at 11:31






  • 1





    Make sure you're using JDK7: that's what the "7" means in "ojdbc7". The classes12.jar is JDK 1.2 vintage - you should have changed years ago. Don't be fooled by "my app still runs normally with classes12.jar". You should not use that ever again.

    – duffymo
    May 30 '14 at 11:33











  • Given the callstack I'd suspect a bug in the driver. When switching between autocommit true and false (and vice versa), the driver must commit the active transaction, and it looks like this commit fails because the driver is in autocommit. On the other hand, I'd expect Oracle to thoroughly test their driver for these kind of basic state switches.

    – Mark Rotteveel
    May 30 '14 at 11:44













  • @MarkRotteveel: Please look at this question. stackoverflow.com/questions/27272317/… I think my question is related to this thread

    – UI_Dev
    Dec 3 '14 at 13:24
















9















I just upgrade to new jdbc driver from classes12.jar to ojdbc7.jar



My app threw an exception when was running with ojdbc7.jar:



java.sql.SQLException: Could not commit with auto-commit set on
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:4443)
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:4490)
at oracle.jdbc.driver.T4CConnection.doSetAutoCommit(T4CConnection.java:943)
at oracle.jdbc.driver.PhysicalConnection.setAutoCommit(PhysicalConnection.java:4


My app still run normally with classes12.jar.



I researched on oracle:



This exception is raised for any one of the following cases:




  • When auto-commit status is set to true and commit or rollback method is called

  • When the default status of auto-commit is not changed and commit or rollback method is called

  • When the value of the COMMIT_ON_ACCEPT_CHANGES property is true and commit or rollback method is called after calling the acceptChanges method on a rowset


But i couldn't find mistake in my source. Please help me give more explaination about this error.










share|improve this question




















  • 1





    Try setting connection.setAutoCommit(false);

    – user432
    May 30 '14 at 11:31






  • 1





    Make sure you're using JDK7: that's what the "7" means in "ojdbc7". The classes12.jar is JDK 1.2 vintage - you should have changed years ago. Don't be fooled by "my app still runs normally with classes12.jar". You should not use that ever again.

    – duffymo
    May 30 '14 at 11:33











  • Given the callstack I'd suspect a bug in the driver. When switching between autocommit true and false (and vice versa), the driver must commit the active transaction, and it looks like this commit fails because the driver is in autocommit. On the other hand, I'd expect Oracle to thoroughly test their driver for these kind of basic state switches.

    – Mark Rotteveel
    May 30 '14 at 11:44













  • @MarkRotteveel: Please look at this question. stackoverflow.com/questions/27272317/… I think my question is related to this thread

    – UI_Dev
    Dec 3 '14 at 13:24














9












9








9


3






I just upgrade to new jdbc driver from classes12.jar to ojdbc7.jar



My app threw an exception when was running with ojdbc7.jar:



java.sql.SQLException: Could not commit with auto-commit set on
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:4443)
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:4490)
at oracle.jdbc.driver.T4CConnection.doSetAutoCommit(T4CConnection.java:943)
at oracle.jdbc.driver.PhysicalConnection.setAutoCommit(PhysicalConnection.java:4


My app still run normally with classes12.jar.



I researched on oracle:



This exception is raised for any one of the following cases:




  • When auto-commit status is set to true and commit or rollback method is called

  • When the default status of auto-commit is not changed and commit or rollback method is called

  • When the value of the COMMIT_ON_ACCEPT_CHANGES property is true and commit or rollback method is called after calling the acceptChanges method on a rowset


But i couldn't find mistake in my source. Please help me give more explaination about this error.










share|improve this question
















I just upgrade to new jdbc driver from classes12.jar to ojdbc7.jar



My app threw an exception when was running with ojdbc7.jar:



java.sql.SQLException: Could not commit with auto-commit set on
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:4443)
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:4490)
at oracle.jdbc.driver.T4CConnection.doSetAutoCommit(T4CConnection.java:943)
at oracle.jdbc.driver.PhysicalConnection.setAutoCommit(PhysicalConnection.java:4


My app still run normally with classes12.jar.



I researched on oracle:



This exception is raised for any one of the following cases:




  • When auto-commit status is set to true and commit or rollback method is called

  • When the default status of auto-commit is not changed and commit or rollback method is called

  • When the value of the COMMIT_ON_ACCEPT_CHANGES property is true and commit or rollback method is called after calling the acceptChanges method on a rowset


But i couldn't find mistake in my source. Please help me give more explaination about this error.







java oracle jdbc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 2 '16 at 17:51









Hardik Doshi

421216




421216










asked May 30 '14 at 11:29









scareworkscarework

56112




56112








  • 1





    Try setting connection.setAutoCommit(false);

    – user432
    May 30 '14 at 11:31






  • 1





    Make sure you're using JDK7: that's what the "7" means in "ojdbc7". The classes12.jar is JDK 1.2 vintage - you should have changed years ago. Don't be fooled by "my app still runs normally with classes12.jar". You should not use that ever again.

    – duffymo
    May 30 '14 at 11:33











  • Given the callstack I'd suspect a bug in the driver. When switching between autocommit true and false (and vice versa), the driver must commit the active transaction, and it looks like this commit fails because the driver is in autocommit. On the other hand, I'd expect Oracle to thoroughly test their driver for these kind of basic state switches.

    – Mark Rotteveel
    May 30 '14 at 11:44













  • @MarkRotteveel: Please look at this question. stackoverflow.com/questions/27272317/… I think my question is related to this thread

    – UI_Dev
    Dec 3 '14 at 13:24














  • 1





    Try setting connection.setAutoCommit(false);

    – user432
    May 30 '14 at 11:31






  • 1





    Make sure you're using JDK7: that's what the "7" means in "ojdbc7". The classes12.jar is JDK 1.2 vintage - you should have changed years ago. Don't be fooled by "my app still runs normally with classes12.jar". You should not use that ever again.

    – duffymo
    May 30 '14 at 11:33











  • Given the callstack I'd suspect a bug in the driver. When switching between autocommit true and false (and vice versa), the driver must commit the active transaction, and it looks like this commit fails because the driver is in autocommit. On the other hand, I'd expect Oracle to thoroughly test their driver for these kind of basic state switches.

    – Mark Rotteveel
    May 30 '14 at 11:44













  • @MarkRotteveel: Please look at this question. stackoverflow.com/questions/27272317/… I think my question is related to this thread

    – UI_Dev
    Dec 3 '14 at 13:24








1




1





Try setting connection.setAutoCommit(false);

– user432
May 30 '14 at 11:31





Try setting connection.setAutoCommit(false);

– user432
May 30 '14 at 11:31




1




1





Make sure you're using JDK7: that's what the "7" means in "ojdbc7". The classes12.jar is JDK 1.2 vintage - you should have changed years ago. Don't be fooled by "my app still runs normally with classes12.jar". You should not use that ever again.

– duffymo
May 30 '14 at 11:33





Make sure you're using JDK7: that's what the "7" means in "ojdbc7". The classes12.jar is JDK 1.2 vintage - you should have changed years ago. Don't be fooled by "my app still runs normally with classes12.jar". You should not use that ever again.

– duffymo
May 30 '14 at 11:33













Given the callstack I'd suspect a bug in the driver. When switching between autocommit true and false (and vice versa), the driver must commit the active transaction, and it looks like this commit fails because the driver is in autocommit. On the other hand, I'd expect Oracle to thoroughly test their driver for these kind of basic state switches.

– Mark Rotteveel
May 30 '14 at 11:44







Given the callstack I'd suspect a bug in the driver. When switching between autocommit true and false (and vice versa), the driver must commit the active transaction, and it looks like this commit fails because the driver is in autocommit. On the other hand, I'd expect Oracle to thoroughly test their driver for these kind of basic state switches.

– Mark Rotteveel
May 30 '14 at 11:44















@MarkRotteveel: Please look at this question. stackoverflow.com/questions/27272317/… I think my question is related to this thread

– UI_Dev
Dec 3 '14 at 13:24





@MarkRotteveel: Please look at this question. stackoverflow.com/questions/27272317/… I think my question is related to this thread

– UI_Dev
Dec 3 '14 at 13:24












4 Answers
4






active

oldest

votes


















17














The latest OJDBC drivers are more compliant then they where. You can turn off this behavior for legacy code:



-Doracle.jdbc.autoCommitSpecCompliant=false


It's a JVM option.






share|improve this answer































    5














    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








    share|improve this answer































      0














      We are IBM WAS v9 with using ojbc6.jar Above configure applied to APP Server, Node agent and DMGR, then it works.



      -Doracle.jdbc.autoCommitSpecCompliant=false



      Dmgr:
      Deployment manager > Process definition > Java Virtual Machine
      Modify "Generic JVM arguments"



      NodeAgent:
      Node agents > nodeagent > Process definition > Java Virtual Machine



      WebSphere Application Server:
      Application servers > WebSphere_Portal > Process definition > Java Virtual Machine
      Modify "Generic JVM arguments"






      share|improve this answer

































        -1














        Changing this in Hibernate properties worked for me



        hibernate.connection.release_mode=auto






        share|improve this answer
























        • Nothing in the question suggests the OP was using Hibernate.

          – Mark Rotteveel
          Mar 16 '18 at 8:22












        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f23953534%2fjava-sql-sqlexception-could-not-commit-with-auto-commit-set-on-at-oracle-jdbc-d%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        17














        The latest OJDBC drivers are more compliant then they where. You can turn off this behavior for legacy code:



        -Doracle.jdbc.autoCommitSpecCompliant=false


        It's a JVM option.






        share|improve this answer




























          17














          The latest OJDBC drivers are more compliant then they where. You can turn off this behavior for legacy code:



          -Doracle.jdbc.autoCommitSpecCompliant=false


          It's a JVM option.






          share|improve this answer


























            17












            17








            17







            The latest OJDBC drivers are more compliant then they where. You can turn off this behavior for legacy code:



            -Doracle.jdbc.autoCommitSpecCompliant=false


            It's a JVM option.






            share|improve this answer













            The latest OJDBC drivers are more compliant then they where. You can turn off this behavior for legacy code:



            -Doracle.jdbc.autoCommitSpecCompliant=false


            It's a JVM option.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 26 '14 at 13:45









            Olafur TryggvasonOlafur Tryggvason

            3,0321725




            3,0321725

























                5














                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








                share|improve this answer




























                  5














                  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








                  share|improve this answer


























                    5












                    5








                    5







                    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








                    share|improve this answer













                    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









                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 21 '17 at 9:04









                    Rushi DaxiniRushi Daxini

                    63165




                    63165























                        0














                        We are IBM WAS v9 with using ojbc6.jar Above configure applied to APP Server, Node agent and DMGR, then it works.



                        -Doracle.jdbc.autoCommitSpecCompliant=false



                        Dmgr:
                        Deployment manager > Process definition > Java Virtual Machine
                        Modify "Generic JVM arguments"



                        NodeAgent:
                        Node agents > nodeagent > Process definition > Java Virtual Machine



                        WebSphere Application Server:
                        Application servers > WebSphere_Portal > Process definition > Java Virtual Machine
                        Modify "Generic JVM arguments"






                        share|improve this answer






























                          0














                          We are IBM WAS v9 with using ojbc6.jar Above configure applied to APP Server, Node agent and DMGR, then it works.



                          -Doracle.jdbc.autoCommitSpecCompliant=false



                          Dmgr:
                          Deployment manager > Process definition > Java Virtual Machine
                          Modify "Generic JVM arguments"



                          NodeAgent:
                          Node agents > nodeagent > Process definition > Java Virtual Machine



                          WebSphere Application Server:
                          Application servers > WebSphere_Portal > Process definition > Java Virtual Machine
                          Modify "Generic JVM arguments"






                          share|improve this answer




























                            0












                            0








                            0







                            We are IBM WAS v9 with using ojbc6.jar Above configure applied to APP Server, Node agent and DMGR, then it works.



                            -Doracle.jdbc.autoCommitSpecCompliant=false



                            Dmgr:
                            Deployment manager > Process definition > Java Virtual Machine
                            Modify "Generic JVM arguments"



                            NodeAgent:
                            Node agents > nodeagent > Process definition > Java Virtual Machine



                            WebSphere Application Server:
                            Application servers > WebSphere_Portal > Process definition > Java Virtual Machine
                            Modify "Generic JVM arguments"






                            share|improve this answer















                            We are IBM WAS v9 with using ojbc6.jar Above configure applied to APP Server, Node agent and DMGR, then it works.



                            -Doracle.jdbc.autoCommitSpecCompliant=false



                            Dmgr:
                            Deployment manager > Process definition > Java Virtual Machine
                            Modify "Generic JVM arguments"



                            NodeAgent:
                            Node agents > nodeagent > Process definition > Java Virtual Machine



                            WebSphere Application Server:
                            Application servers > WebSphere_Portal > Process definition > Java Virtual Machine
                            Modify "Generic JVM arguments"







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 23 '18 at 10:47

























                            answered Nov 23 '18 at 10:32









                            johnson tsangjohnson tsang

                            11




                            11























                                -1














                                Changing this in Hibernate properties worked for me



                                hibernate.connection.release_mode=auto






                                share|improve this answer
























                                • Nothing in the question suggests the OP was using Hibernate.

                                  – Mark Rotteveel
                                  Mar 16 '18 at 8:22
















                                -1














                                Changing this in Hibernate properties worked for me



                                hibernate.connection.release_mode=auto






                                share|improve this answer
























                                • Nothing in the question suggests the OP was using Hibernate.

                                  – Mark Rotteveel
                                  Mar 16 '18 at 8:22














                                -1












                                -1








                                -1







                                Changing this in Hibernate properties worked for me



                                hibernate.connection.release_mode=auto






                                share|improve this answer













                                Changing this in Hibernate properties worked for me



                                hibernate.connection.release_mode=auto







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Mar 16 '18 at 8:01









                                KevinKevin

                                323412




                                323412













                                • Nothing in the question suggests the OP was using Hibernate.

                                  – Mark Rotteveel
                                  Mar 16 '18 at 8:22



















                                • Nothing in the question suggests the OP was using Hibernate.

                                  – Mark Rotteveel
                                  Mar 16 '18 at 8:22

















                                Nothing in the question suggests the OP was using Hibernate.

                                – Mark Rotteveel
                                Mar 16 '18 at 8:22





                                Nothing in the question suggests the OP was using Hibernate.

                                – Mark Rotteveel
                                Mar 16 '18 at 8:22


















                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f23953534%2fjava-sql-sqlexception-could-not-commit-with-auto-commit-set-on-at-oracle-jdbc-d%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                這個網誌中的熱門文章

                                Academy of Television Arts & Sciences

                                L'Équipe

                                1995 France bombings