Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue when using savepoint

843859Mar 24 2008 — edited Mar 28 2008
I am having a problem while using savepoints where after I have committed a transaction, the specific table that I am updating still has an exclusive lock on the table.

The only way I have seen so far to fix this is to either not use the savepoint (not a great idea) or call a different function that performs a simple DB query (a worse idea). Its almost like I have a nested transaction but I'm not sure why that's the case. I have run traces using a profiler to see what is working and what is not. That's where I see an extra "Commit" operation when I do a subsequent call on a different connection that commits the previous transaction.

My code looks like many of the examples on the web.

InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:/myDB");
conn = ds.getConnection();

conn.setAutoCommit(false);
savept = conn.setSavepoint( "SAVEPOINT");

// execute sql statement

if( success )
{
conn.commit();
}
else
{
conn.rollback(savept);
}

Does anybody have an ideas as to what I'm doing wrong?

Thanks,

Tom Stark
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 25 2008
Added on Mar 24 2008
4 comments
468 views