-
1. Re: Why does EAP 6.1 use WrappedDataSourceJDK6 even if JDK used is 7?
andey Nov 15, 2017 1:58 AM (in response to apveitas_at_gmail.com)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 Nov 16, 2017 11:42 AM (in response to andey)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