[ http://issues.apache.org/jira/browse/DERBY-638?page=all ]
Deepa Remesh updated DERBY-638:
-------------------------------
Attachment: d638_repro2.java
Thanks Bernt for looking at this issue.
Patch1 seems better to me and will match more with the embedded implementation.
With patch1, we do not commit any other statements which could be executed in
the meantime. But with patch2, client driver will commit everything executed
before the call to setTransactionIsolation. This, I think is not expected when
we have explicitly set the connection's auto-commit to false.
I am attaching a modified repro 'd638_repro2.java' which executes some
statements after setting auto-commit to false and before the call to
setTransactionIsolation. With patch1, both embedded and client driver show
uncommitted transactions. With patch2, client driver commits everything.
However, it is not clear to me what the correct behaviour should be as the JDBC
spec only has recommendations for the implementation of setTransactionIsolation
method. But I think it will be good to keep embedded and client behaviour
similar.
> setTransactionIsolation behaviour in network client driver is different from
> that of embedded driver
> ----------------------------------------------------------------------------------------------------
>
> Key: DERBY-638
> URL: http://issues.apache.org/jira/browse/DERBY-638
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.2.1.6
> Reporter: Deepa Remesh
> Assigned To: Bernt M. Johnsen
> Attachments: d638.java, d638_repro2.java, DERBY-638-v2.diff,
> DERBY-638.diff
>
>
> When autocommit is set to false, a call to setTransactionIsolation using
> client driver does not end the transaction when the method exits. When a
> close() is called on the conection, it throws an exception.
> Running the code below:
> conn.setAutoCommit(false);
> conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
> try{
> conn.close();
> }catch(SQLException se){
> System.out.println("Got exception when closing the
> connection");
> se.printStackTrace();
> }
> with client driver gives:
> Got exception when closing the connection
> org.apache.derby.client.am.SqlException: java.sql.Connection.close()
> requested while a transaction is in progress on the connection.The
> transaction remains active, and the connection cannot be closed.
> with embedded driver, it works okay and does not throw any exception.
--
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