Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-5915

"Cannot close a connection while a transaction is still active" when using PreparedStatement

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.9.1.0
    • Fix Version/s: None
    • Component/s: JDBC
    • Environment:
      java 1.6+windows 7
    • Urgency:
      Urgent

      Description

      create a Preparedstatement, set its parameters, then execute it. Exception throwed when closing connection.
      PreparedStatement file_stmt = conn.prepareStatement(OperationSql.NEW_FILE);
      file_stmt.setString(1, rel_path);
      file_stmt.setString(2, short_name);
      file_stmt.setInt(3, INITIAL_VERSION);
      int inserted = file_stmt.executeUpdate();
      //System.out.println(inserted);
      file_stmt.close();
      conn.close();
      Exception:
      java.sql.SQLException: Cannot close a connection while a transaction is still active.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.checkForTransactionInProgress(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.close(Unknown Source)

      BTW, I want to use Derby as desktop db of a client application and found it is REALLY buggy!!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                lifesting@gmail.com David Chan
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: