2 Replies Latest reply on Nov 16, 2017 11:42 AM by apveitas_at_gmail.com

    Why does EAP 6.1 use WrappedDataSourceJDK6 even if JDK used is 7?

    apveitas_at_gmail.com

      Hi,

       

      We recently had a requirement to get access to the underlying connection (sql server connection) in our application, which we resolved fairly quickly.

       

      However, we did notice that the DataSource that we get access to (and managed by JBoss) is of type

       

      org.jboss.resource.adapter.jdbc.jdk6.WrappedDataSourceJDK6

       

      Our JBoss is being run with JDK7, so this has caused a bit of concern within the team.

       

      Given the fact we are using JDK7, should the wrapped connection be of type org.jboss.jca.adapters.jdbc.jdk7.WrappedDataSourceJDK7 instead?  Do we need to configure anything else?

       

      Thanks in advance,

      Al

        • 1. Re: Why does EAP 6.1 use WrappedDataSourceJDK6 even if JDK used is 7?
          andey

          JBoss EAP (all versions) wraps the datasource and connection implementation classes provided by third party JDBC drivers (e.g. those supplied by Oracle or Microsoft) in order to provide connection pooling and transaction integration. Consequently, the class instances returned by DataSource.getConnection() and other related APIs cannot be directly cast to vendor specific class types.

           

          Note that the wrapping implementation classes/packages have changed between JBoss EAP 5 and JBoss EAP 6.

           

          Determining the Driver Class for JDBC 4 Style Unwrap

           

          Use the JBoss implementation specific wrappers[1] (temporarily) to obtain the underlying connection and check the class type

          java.sql.Connection wrapped = dataSource.getConnection();

          java.sql.Connection unwrapped = org.jboss.jca.adapters.jdbc.WrappedConnection.class.cast(connection).getUnderlyingConnection();

          System.out.println(unwrapped.getClass());

          [1]Using the JDBC 4 mechanism is preferred over the older (EAP 4/5) style of unwrapping connections. Using the JDBC mechanism frees the application from the requirement to bind to the underlying JBoss implementation classes which are subject to change. Avoiding direct dependency on the IronJacamar implementations prevents warnings related to the use the private org.jboss.ironjacamar.jdbcadapters module.

          • 2. Re: Why does EAP 6.1 use WrappedDataSourceJDK6 even if JDK used is 7?
            apveitas_at_gmail.com

            Hi Anup,

             

            Thanks for the reply and the tip, but we are looking for an answer to our question, which is:

             

            • We are running JBoss 6.1 using JDK7. 
            • The connection we get when we call dataSource.getConnection() is of type org.jboss.resource.adapter.jdbc.jdk6.WrappedDataSourceJDK6
            • Questions
              • Why is the class WrappedDataSourceJDK6 and not WrappedDataSourceJDK7?
              • Is there a way to configure it?
              • Are there any risks to using WrappedDataSourceJDK6 when running JBoss under JDK7?

             

            Thanks,

            Al