I wonder if the transaction issue is a side effect of some other
failure.  I see that you are logging the exception including stack trace
- could you send that please?

- jeremiah

> -----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

Reply via email to