[ 
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:
> [EMAIL PROTECTED]/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

        

Reply via email to