2 Replies Latest reply on Jun 13, 2014 7:42 AM by juanjobio

    How to get the underlaying statement (WrappedStatementJDK6)

    juanjobio

      Hi.

       

      I'm trying to obtain the underlaying statement from a XA connection.

       

      Looking for information I found some code that looks like:

       

      WrappedStatementJDK6 wrappedStatement = (WrappedStatementJDK6)connection.createStatement();

        ... = (castToRealStment) wrappedStatement.getUnderlyingStatement();

       

       

      as far as I know, the class org.jboss.jca.adapters.jdbc.jdk6.WrappedStatementJDK6 is located in the module org.jboss.ironjacamar.jdbcadapters, which is marked as private in the module.xml definition file:

       

      <module xmlns="urn:jboss:module:1.1" name="org.jboss.ironjacamar.jdbcadapters">

          <properties>

              <property name="jboss.api" value="private"/>

          </properties>

      ...

       

      Is there any non private module or another method to get the underlaying statement? I know this will make the application driver dependent but this is not a problem.

       

      Thanks in advance.

       

      EDIT: the main point is to get access to the executeSet method in the SQStatement object (starSQL)

        • 1. Re: How to get the underlaying statement (WrappedStatementJDK6)
          jaikiran

          I don't think there's any non-private module to do what you are doing. In fact, the whole point of marking that private is to warn the user deployment that things might change with resources available in that module without much warning.

           

          I know this will make the application driver dependent but this is not a problem.

          If that's the case, then you can just go ahead and add the dependency on that module.

          • 2. Re: How to get the underlaying statement (WrappedStatementJDK6)
            juanjobio

            Thanks for the info. I will stick with that.

             

            Just to add some information, the preferred solution for jdbc 4 is (i.e. oracle):

             

            if (conn.isWrapperFor(OracleConnection.class)) {

                OracleConnection oracleConn = conn.unwrap(OracleConnection.class);

                ...

              } else {

                throw new IllegalArgumentException("not an OracleConnection");

              }

             

            which is not possible for me.