Search code examples
javaoracleweblogicweblogic12cojdbc

Verifying that OJDBC drivers are updated correctly in weblogic?


We have upgraded our Oracle database to version 12. We have a Java application running Java 7 on Weblogic 12.1.2.0.0 with a database connection using the driver class name: oracle.jdbc.OracleDriver.

I cannot find any ojdbc7.jar drivers anywhere if I do a search in my weblogic installation folder C:\Oracle\Middleware\Oracle_Home however I can find ojdbc6.jar in the location C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc_11.2.0.

I am trying to upgrade to ojdbc7.jar. According to the site Fusion Middleware Configuring and Managing JDBC Data Sources for Oracle WebLogic Server I need to set the following drivers on my class path:

  • ojdbc7.jar
  • ojdbc7_g.jar
  • ojdbc7dms.jar
  • ons.jar
  • oraclepki.jar
  • orai18n.jar
  • orai18n-mapping.jar
  • osdt_cert.jar
  • osdt_core.jar
  • ucp.jar

I downloaded the first few from here and the rest I found in my weblogic installation folder already. I copied them into a folder D:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7.

And I added to my class path all the jars to:

D:\Oracle\Middleware\Oracle_Home\oracle_common\common\bin\commEnv.cmd

set WEBLOGIC_CLASSPATH=C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\ojdbc7.jar;C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\ojdbc7_g.jar;C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\ojdbc7dms.jar;C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\ons.jar;C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\oraclepki.jar;C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\orai18n.jar;C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\orai18n-mapping.jar;C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\osdt_cert.jar;C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\osdt_core.jar;C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.jdbc7\ucp.jar;D:\Oracle\Middleware\Oracle_Home\oracle_common\modules\oracle.pki_12.1.2;%JAVA_HOME%\lib\tools.jar;%PROFILE_CLASSPATH%;%ANT_HOME%/lib/ant-all.jar;%ANT_CONTRIB%/lib/ant-contrib.jar;%CAM_NODEMANAGER_JAR_PATH%

I also went to the windows registry of my service and added the same jars to my CLASSPATH cmd line arguments.

If my application starts up I can see the jars is in my classpath.

But how can I verify which ojdbc drivers are actually being used? And is this the correct way of updating the drivers?

(Now before people start saying we should not run Java 7 apps anymore... This is a legacy app that will be replaced soon but for now this is what I have to work with :) )


Solution

  • But how can I verify which ojdbc drivers are actually being used?

    You may ask the driver getMetaData method.

    Simple example of the relevant part (conn is the database connection).

    md = conn.getMetaData();
    println (md.getDriverVersion());
    

    This gives e.g.

     12.1.0.2.0
    

    This is the version you find in the META-INF/MANIFEST.MF file of the used driver jar.

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: 20.75-b01 (Sun Microsystems Inc.)
    Implementation-Vendor: Oracle Corporation
    Implementation-Title: JDBC
    Implementation-Version: 12.1.0.2.0 
    

    Important thing while updating the JDBC environment is to check the JDBC Compatibility Matrix