We use OJB 0.9.9 with the ODMG layer. 
I have to reopen a Database in the same thread, as you can
see in the example below.

Obviously, closing a Database does not explicitly commit 
and close the current JDBC Connection. This is leading
to uncommitted db-locks on entries in table OJB_LOCKENTRY after 
an sql-delete, if persistent locks are configured and autoCommit 
is set to false.

Why does Database.close() not commit or close the JDBC connection ???

Step 1: open
   Implementation odmg = OJB.getInstance();
   Database db = odmg.newDatabase();
   db.open("jcdAlias#user1#pwd1", Database.OPEN_READ_ONLY);
   Transaction tx = odmg.newTransaction();
   tx.begin();
   //...delete from OJB_LOCKENTRY
   tx.commit();
   db.close();
   // current connection is not committed nor closed
   java.sql.Connection con = ((TransactionImpl) tx).getTransactionImpl()
      .getBroker().serviceConnectionManager().getConnection();
   log.debug("JDBC AutoCommit "+con.getAutoCommit()); // false
   log.debug("JDBC Connection "+(con.isClosed() ? "closed" : "open")); // its open
Step 2: reopen
   db.open("jcdAlias#user2#pwd2", Database.OPEN_READ_WRITE);
   Transaction tx = odmg.newTransaction();
   tx.begin();
   //...delete from OJB_LOCKENTRY
   //connection freeze here

Regards,
Juergen

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to