Do any of the DRTs do a transaction, then interact with the database in the regular way? The transaction seems to work fine, it's the next call to the database that fails.
The code below, once uncommented out, fails. Scott -----Original Message----- From: Chad Schoettger Sent: Thursday, May 12, 2005 12:03 PM To: Beehive Developers Subject: RE: Problem using transactions with JDBC control Hi Scott, The drts for the jdbcontrol include a few unit tests for transactions -- they are not currently failing. Other than the move from controlhaus to beehive nothing has changed in the jdbccontrol code. In the code sample below why is the connection.commit() call commented out? Does it work for you if it is uncommented? - Chad -----Original Message----- From: Scott Semyan Sent: Thursday, May 12, 2005 11:46 AM To: Beehive Developers Subject: Problem using transactions with JDBC control I have a new error in the PetStore web sample. I have a section of code that uses a transaction to add something to the database. I initially enabled this with the following code: public int addOrder(Order order, Cart cart) { try { java.sql.Connection connection = _dbControl.getConnection(); connection.setAutoCommit( false ); // Add order to DB // Add the cart items and update the quantities in the DB //connection.commit(); } catch (SQLException e) { _logger.error( "Unexpected DAO exception", e ); throw new DataStoreException("unexpected database exception"); } return orderId; } This used to work fine. Now when I do it, the order is added correctly, but the subsequent call to the database (to read the contents of the order just entered) generates the following: Exception: org.apache.beehive.controls.api.ControlException: SQL Exception while attempting to close database connection.[Invalid transaction state.] caused by : SQL Exception: Invalid transaction state. Did anything change recently? Is this the proper way to do transactions with the JDBC control? Scott Semyan