I am running an application under JBoss 7 (Java 1.7) which connects to an Oracle 10.2.0.3 database using ojdbc14.jar
.
The same application also has to connect to an different Oracle database, 12.1.0.2 for which I have an ojdbc7.jar
.
Each Oracle driver jar was placed in its own JBoss module:
D:\Jboss\jboss-7.2.0.Final\modules\com\Oracle\ojdbc7\main\ojdbc7.jar
D:\Jboss\jboss-7.2.0.Final\modules\com\Oracle\ojdbc14\main\ojdbc14.jar
Assume the module.xml
files are correct (they are; the ojdbc#.jar.index
file gets created).
In standalone.xml
, I declared the following under <drivers>
:
<driver name="oracle14" module="com.oracle.ojdbc14">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
<driver name="oracle7" module="com.oracle.ojdbc7">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
For my datasources, I did the following:
<datasource jndi-name="java:jboss/datasources/OracleTen" pool-name="OracleTen-DEV" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:@ORACLE10DEV:49125:databasename</connection-url>
<driver>oracle14</driver>
...
</datasource>
<datasource jndi-name="java:jboss/datasources/OracleTwelve" pool-name="OracleTwelve-DEV" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:@ORACLE12DEV:1521:databasename</connection-url>
<driver>oracle7</driver>
...
</datasource>
When trying to run against the Oracle 12 datasource, it uses the Oracle 10 driver, as evidenced by the code throwing:
Caused by: java.sql.SQLException: ORA-28040: No matching authentication protocol
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:294)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:357)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:439)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:254)
... 18 more
When I comment-out the oracle14
driver and the datasource using it in standalone.xml
, the Oracle 12 datasource runs as expected.
I assume this is some sort of classloader issue, but weren't modules supposed to solve this problem? What should I do to allow both to connect without issues?
I have not yet attempted to make the Oracle 10 datasource reliant on the Oracle 12 drivers.
Remove ojdbc14.jar
. Use ojdbc7.jar
in both/all modules.
The 12.1.0.2 driver is backwards compatible with a 10.2.0.3 server.
The matrix on this page doesn't cover 10.2, but it says:
Best Practice that we recommend is, JDBC driver version should always be either same as or higher than the Oracle database version being used in order to leverage the latest capabilities of the JDBC driver.