You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org> on 2006/08/09 16:17:13 UTC

[jira] Created: (DERBY-1654) Calling Connection.commit() does not throw exception in autocommit mode

Calling Connection.commit() does not throw exception in autocommit mode
-----------------------------------------------------------------------

                 Key: DERBY-1654
                 URL: http://issues.apache.org/jira/browse/DERBY-1654
             Project: Derby
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 10.1.3.1
            Reporter: Dyre Tjeldvoll
            Priority: Minor
             Fix For: 10.3.0.0
         Attachments: simple.java

The jdbc spec (don't know chapter and verse) states that an attempt to call Connection.commit() when Connection.getAutoCommit() is true, must throw an exception. The attached repro (simple.java) runs fine with Derby (and Postgres), but fails with MySQL:

dt136804@khepri29~/java$ java -cp $CLASSPATH:. simple com.mysql.jdbc.Driver 'jdbc:mysql://localhost/joindb' joinuser joinpass foo4
java.sql.SQLException: Can't call commit when autocommit=true
        at com.mysql.jdbc.Connection.commit(Connection.java:2161)
        at simple.main(simple.java:17)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DERBY-1654) Calling Connection.commit() does not throw exception in autocommit mode

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1654?page=comments#action_12426941 ] 
            
Dyre Tjeldvoll commented on DERBY-1654:
---------------------------------------

I think you are making a very good point. And I only discovered this because I was trying to port an app developed with Derby to MySQL, and the difference in behavior caused my app to crash. I thought it was a MySQL problem until Dag (Wanvik) told me that the MySQL behavior is required by JDBC. 

> Calling Connection.commit() does not throw exception in autocommit mode
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1654
>                 URL: http://issues.apache.org/jira/browse/DERBY-1654
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.3.1
>            Reporter: Dyre Tjeldvoll
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: simple.java
>
>
> The jdbc spec (don't know chapter and verse) states that an attempt to call Connection.commit() when Connection.getAutoCommit() is true, must throw an exception. The attached repro (simple.java) runs fine with Derby (and Postgres), but fails with MySQL:
> dt136804@khepri29~/java$ java -cp $CLASSPATH:. simple com.mysql.jdbc.Driver 'jdbc:mysql://localhost/joindb' joinuser joinpass foo4
> java.sql.SQLException: Can't call commit when autocommit=true
>         at com.mysql.jdbc.Connection.commit(Connection.java:2161)
>         at simple.main(simple.java:17)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DERBY-1654) Calling Connection.commit() does not throw exception in autocommit mode

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1654?page=comments#action_12426932 ] 
            
Kathey Marsden commented on DERBY-1654:
---------------------------------------

We might need to be careful with regard to existing appication impact on this one.  Is anyone planning on fixing this for 10.2?   I think I would prefer to see an announcement now that we plan to fix this for 10.3 and defer it to the next release.  I'd recommend DERBY-790 instead to anyone  looking for a low hanging fruit JDBC compliance issue #:)





> Calling Connection.commit() does not throw exception in autocommit mode
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1654
>                 URL: http://issues.apache.org/jira/browse/DERBY-1654
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.3.1
>            Reporter: Dyre Tjeldvoll
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: simple.java
>
>
> The jdbc spec (don't know chapter and verse) states that an attempt to call Connection.commit() when Connection.getAutoCommit() is true, must throw an exception. The attached repro (simple.java) runs fine with Derby (and Postgres), but fails with MySQL:
> dt136804@khepri29~/java$ java -cp $CLASSPATH:. simple com.mysql.jdbc.Driver 'jdbc:mysql://localhost/joindb' joinuser joinpass foo4
> java.sql.SQLException: Can't call commit when autocommit=true
>         at com.mysql.jdbc.Connection.commit(Connection.java:2161)
>         at simple.main(simple.java:17)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (DERBY-1654) Calling Connection.commit() does not throw exception in autocommit mode

Posted by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-1654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dyre Tjeldvoll closed DERBY-1654.
---------------------------------

    Resolution: Won't Fix

The issue with existing applications and usability undesirable to fix this.

> Calling Connection.commit() does not throw exception in autocommit mode
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1654
>                 URL: https://issues.apache.org/jira/browse/DERBY-1654
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.3.1
>            Reporter: Dyre Tjeldvoll
>            Priority: Minor
>         Attachments: simple.java
>
>
> The jdbc spec (don't know chapter and verse) states that an attempt to call Connection.commit() when Connection.getAutoCommit() is true, must throw an exception. The attached repro (simple.java) runs fine with Derby (and Postgres), but fails with MySQL:
> dt136804@khepri29~/java$ java -cp $CLASSPATH:. simple com.mysql.jdbc.Driver 'jdbc:mysql://localhost/joindb' joinuser joinpass foo4
> java.sql.SQLException: Can't call commit when autocommit=true
>         at com.mysql.jdbc.Connection.commit(Connection.java:2161)
>         at simple.main(simple.java:17)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (DERBY-1654) Calling Connection.commit() does not throw exception in autocommit mode

Posted by "Lance J. Andersen" <La...@Sun.COM>.
This has been a requirement since JDBC 1.0 and at there are no plans to 
change this given the complexity of the autocommit issue with various 
vendors.  It is expected the applications that are well behaved will 
know what mode they are in and invoke the correct methods.

-lance

Daniel John Debrunner (JIRA) wrote:
>     [ http://issues.apache.org/jira/browse/DERBY-1654?page=comments#action_12426938 ] 
>             
> Daniel John Debrunner commented on DERBY-1654:
> ----------------------------------------------
>
> I think the behaviour mandated by the spec is a useability problem. If I want to write a generic method that needs to commit or rollback  the transaction at the end of its work I have to have extra logic that checks to see if auto-commit is on. I've actually never understood the logic in disallowing these methods (commit & rollback) in auto-commit mode.  Even with auto-commit true there are points in time in the user application where a transaction is active, if the applicaiton wants to commit/rollback  that  work why is a different non-intutive api required (close the Statement and/or all of its ResultSets) rather than the obvious calls conn.commit() & rollback()?
>
>   
>> Calling Connection.commit() does not throw exception in autocommit mode
>> -----------------------------------------------------------------------
>>
>>                 Key: DERBY-1654
>>                 URL: http://issues.apache.org/jira/browse/DERBY-1654
>>             Project: Derby
>>          Issue Type: Bug
>>          Components: JDBC
>>    Affects Versions: 10.1.3.1
>>            Reporter: Dyre Tjeldvoll
>>            Priority: Minor
>>             Fix For: 10.3.0.0
>>
>>         Attachments: simple.java
>>
>>
>> The jdbc spec (don't know chapter and verse) states that an attempt to call Connection.commit() when Connection.getAutoCommit() is true, must throw an exception. The attached repro (simple.java) runs fine with Derby (and Postgres), but fails with MySQL:
>> dt136804@khepri29~/java$ java -cp $CLASSPATH:. simple com.mysql.jdbc.Driver 'jdbc:mysql://localhost/joindb' joinuser joinpass foo4
>> java.sql.SQLException: Can't call commit when autocommit=true
>>         at com.mysql.jdbc.Connection.commit(Connection.java:2161)
>>         at simple.main(simple.java:17)
>>     
>
>   

[jira] Commented: (DERBY-1654) Calling Connection.commit() does not throw exception in autocommit mode

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1654?page=comments#action_12426938 ] 
            
Daniel John Debrunner commented on DERBY-1654:
----------------------------------------------

I think the behaviour mandated by the spec is a useability problem. If I want to write a generic method that needs to commit or rollback  the transaction at the end of its work I have to have extra logic that checks to see if auto-commit is on. I've actually never understood the logic in disallowing these methods (commit & rollback) in auto-commit mode.  Even with auto-commit true there are points in time in the user application where a transaction is active, if the applicaiton wants to commit/rollback  that  work why is a different non-intutive api required (close the Statement and/or all of its ResultSets) rather than the obvious calls conn.commit() & rollback()?

> Calling Connection.commit() does not throw exception in autocommit mode
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1654
>                 URL: http://issues.apache.org/jira/browse/DERBY-1654
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.3.1
>            Reporter: Dyre Tjeldvoll
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: simple.java
>
>
> The jdbc spec (don't know chapter and verse) states that an attempt to call Connection.commit() when Connection.getAutoCommit() is true, must throw an exception. The attached repro (simple.java) runs fine with Derby (and Postgres), but fails with MySQL:
> dt136804@khepri29~/java$ java -cp $CLASSPATH:. simple com.mysql.jdbc.Driver 'jdbc:mysql://localhost/joindb' joinuser joinpass foo4
> java.sql.SQLException: Can't call commit when autocommit=true
>         at com.mysql.jdbc.Connection.commit(Connection.java:2161)
>         at simple.main(simple.java:17)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] Commented: (DERBY-1654) Calling Connection.commit() does not throw exception in autocommit mode

Posted by Kathey Marsden <km...@sbcglobal.net>.
Dyre Tjeldvoll (JIRA) wrote:

>Somehow I expected that you would say just that :) If you look closely you will see that the issue was created with "Fix Version" 10.3.
>  
>
Thanks  Dyre for thinking ahead  on this. My radar is on pure reflex.  
Best I just try to shut the darn thing down for the next week until I 
leave on vacation and flick back on  in September when I return.  It's 
good to know you and others are out there watching out for  the users.

Kathey


[jira] Commented: (DERBY-1654) Calling Connection.commit() does not throw exception in autocommit mode

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1654?page=comments#action_12426936 ] 
            
Dyre Tjeldvoll commented on DERBY-1654:
---------------------------------------

Somehow I expected that you would say just that :) If you look closely you will see that the issue was created with "Fix Version" 10.3.

> Calling Connection.commit() does not throw exception in autocommit mode
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1654
>                 URL: http://issues.apache.org/jira/browse/DERBY-1654
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.3.1
>            Reporter: Dyre Tjeldvoll
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: simple.java
>
>
> The jdbc spec (don't know chapter and verse) states that an attempt to call Connection.commit() when Connection.getAutoCommit() is true, must throw an exception. The attached repro (simple.java) runs fine with Derby (and Postgres), but fails with MySQL:
> dt136804@khepri29~/java$ java -cp $CLASSPATH:. simple com.mysql.jdbc.Driver 'jdbc:mysql://localhost/joindb' joinuser joinpass foo4
> java.sql.SQLException: Can't call commit when autocommit=true
>         at com.mysql.jdbc.Connection.commit(Connection.java:2161)
>         at simple.main(simple.java:17)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira