6 Replies Latest reply on Sep 2, 2011 3:09 AM by pi4630

    WrappedConnectionJDK6

    impio

      Hi,

      I'd like to know if it is possible to get a java.sql.Connection (or whatever my datasource is giving back, in this case oracle) out of a JBoss 5.1 managed datasource.

      What I'm getting now is a org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6

       

      I find this behaviour very annoying, is there any good reason for it?

       

      Thanks

        • 1. Re: WrappedConnectionJDK6
          peterj

          Here is the declaration of WrappedConnectionJDK6:

           

          package org.jboss.resource.adapter.jdbc.jdk6;

          ...

          import org.jboss.resource.adapter.jdbc.WrappedConnection;

          ...

          public class WrappedConnectionJDK6 extends WrappedConnection

           

          And here is WrappedConnection:

           

          package org.jboss.resource.adapter.jdbc;

          ...

          import java.sql.Connection;

          ...

          public abstract class WrappedConnection extends JBossWrapper implements Connection

           

          You do know that java.sql.Connection is an interface, right? And as you can see WrappedConnectionJDK6 implements java.sql.Connection.

          • 2. Re: WrappedConnectionJDK6
            impio

            Yes, sorry if I wasn't accurate enough.

            My problem is that to use oracle AQ I need the OracleConnection, which is the underlying one. Using spring jmstemplate and trying to reach an oracle AQ seems pretty hard due to this issue.

            Thanks for the reply

            • 3. Re: WrappedConnectionJDK6
              jaikiran

              See "How to retrieve the underlying Oracle connection object?" section in this wiki http://community.jboss.org/wiki/SetUpAOracleDatasource

              • 4. Re: WrappedConnectionJDK6
                pi4630

                Yes, but it is not explained where WrappedConnection does come from or, to be more precise, where WrappedConnectionJDK6 comes from. How is the class resolved? Which JAR do I need? (Using JBoss-6.0.0.-Final).

                 

                In debug mode, I see it, i.e.

                 

                 

                {code}

                OracleConnection oc = (OracleConnection) preparedStatement.getConnection();

                {code}

                 

                When I inspect preparedStatement.getConnection(), this has =WrappedConnectionJDK6. By accessing WrappedConnectionJDK6, I could access WrappedConnection, since it is inherited, but I can't use the class, as the import doesn't get resolved.

                 

                thx

                • 5. Re: WrappedConnectionJDK6
                  jaikiran

                  I don't have my workspace in front of me, so I can't tell you about the jar containing this class. But you can use Tattletale http://www.jboss.org/tattletale to generate a report against your JBOSS_HOME/common/lib and JBOSS_HOME/lib jars to find out which jar contains that class.

                  • 6. Re: WrappedConnectionJDK6
                    pi4630

                    Thanks Jaikiran, that made me aware of another goodie JBoss Project

                     

                    The JAR containing WrappedConnectionJDK6 is jboss-common-jdbc-wrapper.jar and it is located in $JBOSS_HOME/common/lib as of jboss-6.0.0.Final.