4 Replies Latest reply on Aug 25, 2002 1:28 AM by davidjencks

    Connection handle is not currently associated with a Managed

    y_bhakta

      I am using jboss3.0.

      I created database NoTx Resource Adapter. Everything started fine.

      It works fine first time(gets the connection and executes it properly) and gives below error next time.

      The samething worked fine with jboss2.4.6

      java.sql.SQLException: Connection handle is not currently associated with a ManagedConnection
      at org.jboss.resource.adapter.jdbc.local.LocalConnection.checkStatus(LocalConnection.java:774)
      at org.jboss.resource.adapter.jdbc.local.LocalConnection.prepareStatement(LocalConnection.java:188)
      at com.ispring.adapters.database.cci.CciInteraction._$1635(CciInteraction.java:328)
      at com.ispring.adapters.database.cci.CciInteraction.execute(CciInteraction.java:61)
      at
      .............
      .............


      Thanks
      Bhakta

        • 1. Re: Connection handle is not currently associated with a Man
          davidjencks

          Can you provide more details of how you are obtaining and using the connection handle, showing where it is obtained and where it is closed.

          Does your adapter implement associateConnection properly?

          What is the relationship between the cci adapter stuff you have implemented and the jboss local jdbc wrapper that it appears to be using?

          • 2. Re: Connection handle is not currently associated with a Man
            y_bhakta

            Below is the code of CciManagedConnection.associateConnection()
            public void associateConnection(Object connection) throws ResourceException
            {
            if (connection instanceof CciConnection)
            {
            CciConnection cciCon = (CciConnection) connection;
            cciCon.associateConnection(this);
            }
            else
            {
            throw new IllegalStateException("Invalid connection object: " + connection);
            }
            }

            Below is the code of CciConnection.associateConnection()

            public void associateConnection(CciManagedConnection newMc) throws ResourceException
            {
            // dissociate handle with current managed connection
            mc.removeCciConnection(this);
            // associate handle with new managed connection
            newMc.addCciConnection(this);
            mc = newMc;
            }

            removeConnection() puts connection in Set and removeConnection() removes the connection from Set.

            I am creating the DataSource and associating the DataSource to Adapter and ManagedConnectionFactory returns the Connection from DataSource.

            Thanks
            Bhakta

            • 3. Re: Connection handle is not currently associated with a Man
              y_bhakta

              Below is the code of CciManagedConnection.associateConnection()
              public void associateConnection(Object connection) throws ResourceException
              {
              if (connection instanceof CciConnection)
              {
              CciConnection cciCon = (CciConnection) connection;
              cciCon.associateConnection(this);
              }
              else
              {
              throw new IllegalStateException("Invalid connection object: " + connection);
              }
              }

              Below is the code of CciConnection.associateConnection()

              public void associateConnection(CciManagedConnection newMc) throws ResourceException
              {
              // dissociate handle with current managed connection
              mc.removeCciConnection(this);
              // associate handle with new managed connection
              newMc.addCciConnection(this);
              mc = newMc;
              }

              removeConnection() puts connection in Set and removeConnection() removes the connection from Set.

              I am creating the DataSource and associating the DataSource to Adapter and ManagedConnectionFactory returns the Connection from DataSource.

              Thanks
              Bhakta

              • 4. Re: Connection handle is not currently associated with a Man
                davidjencks

                I have no idea what this means:

                I am creating the DataSource and associating the DataSource to Adapter and ManagedConnectionFactory returns the Connection from DataSource.

                You answered one out of 3 of my questions. What you show looks ok. Is associateConnection ever called?