Thursday, May 16, 2013

How to Determine JDBC Driver Version Installed with WebLogic Server?



Updated (08/15/2014)

Since the writing of this blog article, things have changed.[5,6] For example, in WebLogic Server 12.1.2, the following files have moved from wlserver/server/lib to ORACLE_HOME/oracle_common/modules/oracle.jdbc_11.2.0:
  • ojdbc5.jar
  • ojdbc6.jar
  • ojdbc6dms.jar
  • ojdbc5_g.jar
  • ojdbc6_g.jar
Updated (12/09/2014)

Added a new section "List of Thin JDBC Driver Versions"


There are built-in JDBC drivers installed with WebLogic Server. For example, the 11g version of the Oracle Thin driver (ojdbc6.jar for JDK 6) is bundled with WebLogic Server. That driver can be found in :
  • WL_HOME/server/lib
If you plan to use a different version of any of the drivers installed with WebLogic Server, you can replace the driver file in WL_HOME/server/lib with an updated version of the file or add the new file to the front of your CLASSPATH. However, be warned that if you replaced the default JDBC driver in WLS, you might miss some enhancements that were shipped with it. For example, you should not replace the one from WLS with the one from Oracle JDBC (i.e., D:\download\oracle\JDBC\JDBCDrivers\11.2.0.3\ojdbc6.jar) without consultation.

Copies of Oracle Thin drivers and other supporting files (e.g., a debug version named ojdbc6_g.jar) can also be found in
  • WL_HOME/server/ext/jdbc/
There is a subdirectory in this folder for each DBMS. If you need to revert to the version of the driver installed with WebLogic Server, you can copy the file from WL_HOME/server/ext/jdbc/ to WL_HOME/server/lib.

Manifest File


Built-in JDBC driver files are listed in the manifest of weblogic.jar (see below). So they can be loaded when weblogic.jar is loaded (when the server starts). Therefore, you do not need to add them to your CLASSPATH[3].

...
Implementation-Version: 10.3.6.0
Class-Path: ../../../modules/features/weblogic.server.modules_10.3.6.0
.jar schema/weblogic-domain-binding.jar schema/weblogic-domain-bindin
g-compatibility.jar schema/diagnostics-binding.jar schema/diagnostics
-image-binding.jar wlcipher.jar webservices.jar xmlx.jar ojdbc6.jar o
ns.jar ucp.jar aqapi.jar EccpressoAsn1.jar EccpressoCore.jar Eccpress
oJcae.jar mysql-connector-java-commercial-5.1.17-bin.jar wlsqlserver
.jar wldb2.jar wlsybase.jar wlinformix.jar fmwgenerictoken.jar wlw-la
ngx.jar jcom.jar weblogic-L10N.jar


If you plan to use a third-party JDBC driver that is not installed with WebLogic Server, you need to update the WebLogic Server's classpath to include the location of the JDBC driver classes. Edit the
  • commEnv.cmd/sh script

in WL_HOME/common/bin and prepend your classes as described in "Modifying the Classpath" in the Oracle Fusion Middleware Command Reference for Oracle WebLogic Server.

How to Determine JDBC Driver Version?


Before you switch to a different version of any drivers, you better find out which version of the existing one is.

To find out which Oracle Thin driver version is used, you can do:

$ java -jar wlserver_10.3/server/lib/ojdbc6.jar
Exception in thread "main" java.lang.ClassFormatError: oracle.jdbc.OracleDriver (unrecognized class file version)
at java.lang.VMClassLoader.defineClass(libgcj.so.7rh)
at java.lang.ClassLoader.defineClass(libgcj.so.7rh)
at java.security.SecureClassLoader.defineClass(libgcj.so.7rh)
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)


However, you need to use the correct version of Java executable. For example, the following default java executable is in version 1.4.2 and won't work because our driver was compiled with JDK 6.

$ which java
/usr/bin/java

$ java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-46)


So, after choosing the correct java executable, we have found out the Oracle JDBC Thin driver's version as below:

$ /export/home/bench/workload/target_jvm/jdk-hs/bin/java -jar wlserver_10.3/server/lib/ojdbc6.jar
Oracle 11.2.0.3.0 JDBC 4.0 compiled with JDK6 on Fri_Nov_04_08:05:20_PDT_2011
#Default Connection Properties Resource
#Thu May 16 15:03:40 PDT 2013


List of Thin JDBC Driver Versions

In the following table, we have listed the versions of Oracle JDBC Thin Driver[9] that comes with WebLogic Server version 9.2 to 12c.  But, always consult with Oracle Support for confirmation.


WLS Version
Date
Thin Jar Version
12.1.2
2012
11.2.0.3
12.1.1
December 2011
11.2.0.3
10.3.6
December 2011
11.2.0.3
10.3.5
April 2011
11.2.0.3
10.3.4
January 2011
11.2.0.2
10.3.3
April 2010
11.1.0.7
10.3.2
November 2009
11.1.0.7
10.3.1
June 2009
11.1.0.7
10.3
August 2008
11.1.0.6.0
10.0 MP2
January 2009
11.1.0.6.0
10.0 MP1
October 2007
10.2.0.2.0
9.2.0
July 2006
10.2.0.2.0


References

  1. Using JDBC Drivers with WebLogic Server (11g)
  2. Oracle® Fusion Middleware Command Reference for Oracle WebLogic Server 11g Release 1 (10.3.1)
  3. Adding Classes to the JAR File's Classpath (The Java Tutorials)
  4. Oracle Database 11g Release 2 JDBC Drivers
  5. What's New in Oracle WebLogic Server 12c
  6. Understanding the Standard Installation Topology (12c)
  7. ojdbc6.jar Download
    • Be warned that upgrading the driver (say from 11.2.0.3 to 11.2.0.4) by downloading is not the right way. You could be missing some bug fixes needed by WebLogic Server. So, always consider to apply the patch provided by Oracle to upgrade your WLS JDBC driver appropriately.
  8. Older JDBC Driver Downloads - 10g (Unsupported)
  9. Type 3 vs. Type 4 JDBC Drivers
    • Type 4 JDBC Drivers
      • The JDBC Thin driver (i.e., ojdbc6.jar) is a pure Java, Type IV driver that can be used in applications and applets. It is platform-independent and does not require any additional Oracle software on the client-side. The JDBC Thin driver communicates with the server using SQL*Net to access Oracle Database.
      • The JDBC Thin driver allows a direct connection to the database by providing an implementation of SQL*Net on top of Java sockets. The driver supports the TCP/IP protocol and requires a TNS listener on the TCP/IP sockets on the database server.
      • To use the Oracle Type 4 JDBC drivers, you create a JDBC data source in your WebLogic Server configuration and select the JDBC driver to create the physical database connections in the data source. Applications can then look up the data source on the JNDI tree and request a connection.

2 comments:

Blogger said...

If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (no matter why you broke up) you gotta watch this video
right away...

(VIDEO) Get your ex CRAWLING back to you...?

Blogger said...

BlueHost is definitely one of the best hosting provider for any hosting plans you need.