1 Reply Latest reply on Oct 1, 2004 9:43 AM by jokes

    "Connection handle has been closed and is unusable" error in

    jokes

      Folks,

      Error in Jboss3.2.5:

      Iam trying to use my own Transaction handler in my stateful session. And iam getting the user transaction from jboss to do the same.

      // Piece of transaction handler code.
      try {
      Context context = new InitialContext();
      UserTransaction userTxn = (UserTransaction)context.lookup("java:comp/UserTransaction");
      return userTxn;
      }
      catch (Exception e) {
      throw new SystemException("ERR####", "Unable to obtain UserTransaction.", e);
      }

      // End


      And when i open a connection the first time, it is getting me the data. And the next time the transaction handler is trying to use the same connection and the following error is gettign thrown:


      Caused by: java.sql.SQLException: Connection handle has been closed and is unusable
      at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:771)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:756)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:205)

        • 1. Re:
          jokes

          Found some progress in the problem.

          Actually, my code which handles the transaction also makes a statement caching. And here the connection object is checked whether it has executed a set of statements and if not then the same connection is getting assigned again for the second time.

          And here the handle which is getting returned has been closed by the jboss.

          Now i have made the no. of statements to get executed to 0.

          So now everytime a connection is required the transaction handler is gettign me a new connection.

          Now the question would be:
          can i make statement caching on a connection, if so how?