Upgrading to use the Latest Oracle 19.x Drivers with WebLogic Server

This blog focuses on picking up the latest 19.x Oracle JDBC drivers when running with WebLogic Server.  Note that release19.x is the Long Term Support (LTS) release of the Oracle JDBC drivers.  This article generally can be used to update to releases later than 19.x but the description below uses “19”.

WLS 12.2.1.3.0 ships with release 12.2.0.1 of the Oracle JDBC driver and customers may want to upgrade to 19.x to use later features.  WLS 12.2.1.4.0 and 14.1.1.0.0 ship with release 19.3 Oracle driver and customers may want to upgrade to the latest 19.x version to get bug fixes.

At this time, this article does not apply to Fusion MiddleWare (FMW) deployments of WLS..

Required Oracle 19.x Driver Files

This section lists the files required to use an Oracle JDBC 19.x driver.  Conveniently, the download page now provides these 14 jar files in a single download file (don’t use xmlparserv2.jar).

Note: These jar files must be added to the CLASSPATH used for running WebLogic Server at the head of the CLASSPATH. They must come before all of the 12.x or 19.x Oracle database client jar files.

Select one of the following ojdbc files.   The _g jar files are using for debugging and required if you want to enable driver level logging.  If you are using FMW, you must use the “dms” version of the jar file.  WLS uses the non-“dms” version of the jar by default.

  • ojdbc8-full/ojdbc8.jar

  • ojdbc8-full/ojdbc8_g.jar

  • ojdbc8-full/ojdbc8dms.jar

  • ojdbc8-full/ojdbc8dms_g.jar

    The following table lists additional required driver files:

     

File

Description

ojdbc8-full/simplefan.jar

Fast Application
Notification

ojdbc8-full/ucp.jar

Universal Connection Pool

ojdbc8-full/ons.jar

Oracle Network Server
client

ojdbc8-full/orai18n.jar

Internationalization
support

ojdbc8-full/oraclepki.jar

Oracle Wallet support

ojdbc8-full/osdt_cert.jar

Oracle Wallet support

ojdbc8-full/osdt_core.jar

Oracle Wallet support

ojdbc8-full/xdb6.jar

SQLXML support

ojdbc8-full/xmlparserv2_sans_jaxp_services.jar SQL XML support
 

 

Download Oracle 19.x Database Files

You can download the required jar files from https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html.  Select the latest 19.x release available for download and select “Zipped JDBC driver (ojdbc8.jar) and Companion Jars “, which includes ojdbc8.jar, ucp.jar, and the companion jars and diagnosability jars. Currently it’s about 37MB in size (relatively small).

Update the WebLogic Server CLASSPATH or PRE_CLASSPATH

To use an Oracle 19.x JDBC driver, you must update the CLASSPATH in your WebLogic Server environment. Prepend the required files specified in Required Oracle 19.x Driver Files listed above to the CLASSPATH (before the 12.x or earlier 19.x Driver jar files).  If you are using startWebLogic.sh, you need to set the PRE_CLASSPATH. The following code sample outlines a simple shell script that updates the PRE_CLASSPATH of your WebLogic environment. Make sure ORACLE19 is set appropriately to the directory where the files were unpackaged.

#!/bin/sh
# source this file in to add the new 19.x jar files at the beginning of the CLASSPATH

ORACLE19=”full pathname to unpacked jar file directory”
PRE_CLASSPATH=
case “`uname`” in
*CYGWIN*)
SEP=”;”
;;
Windows_NT)
SEP=”;”
;;
*)
SEP=”:”
;;
esac

dir=${ORACLE19:?}
# We need one of the following

#ojdbc8-full/ojdbc8.jar
#ojdbc8-full/lib/ojdbc8_g.jar
#
ojdbc8-full/lib/ojdbc8dms.jar
#
ojdbc8-full/lib/ojdbc8dms_g.jar

if [ “$1” = “” ]
then
ojdbc=ojdbc8.jar
else
ojdbc=”$1″
fi

case “$ojdbc” in
ojdbc8.jar)
ojdbc=
ojdbc8-full/$ojdbc
;;
ojdbc8_g.jar|ojdbc8dms.jar|ojdbc8dms_g.jar)
ojdbc=
ojdbc8-diag/$ojdbc
;;
*)
echo “Invalid argument – must be ojdbc8.jar|ojdbc8_g.jar|ojdbc8dms.jar|ojdbc8dms_g.jar”
exit 1
;;
esac

PRE_CLASSPATH=”${dir}/${ojdbc}${SEP}$PRE_CLASSPATH”
PRE_CLASSPATH=”${dir}/
ojdbc8-full/simplefan.jar${SEP}$PRE_CLASSPATH”
PRE_CLASSPATH=”${dir}/
ojdbc8-full/ucp.jar${SEP}$PRE_CLASSPATH”
PRE_CLASSPATH=”${dir}/
ojdbc8-full/ons.jar${SEP}$PRE_CLASSPATH”
PRE_CLASSPATH=”${dir}/
ojdbc8-full/orai18n.jar${SEP}$PRE_CLASSPATH”
PRE_CLASSPATH=”${dir}/
ojdbc8-full/oraclepki.jar${SEP}$PRE_CLASSPATH”
PRE_CLASSPATH=”${dir}/
ojdbc8-full/osdt_cert.ja ${SEP}$PRE_CLASSPATH”
PRE_CLASSPATH=”${dir}/
ojdbc8-full/osdt_core.jar${SEP}$PRE_CLASSPATH”
PRE_CLASSPATH=”${dir}/
ojdbc8-full/xdb6.jar${SEP}$PRE_CLASSPATH”
PRE_CLASSPATH=”${dir}/ojdbc8-full/xmlparserv2_sans_jaxp_services.jar${SEP}$PRE_CLASSPATH”
export PRE_CLASSPATH
# don’t use
xmlparserv2.jar – it conflicts with WLS classes

For example, save this script in your environment with the name setdb19_jars.sh. Then run script with ojdbc8.jar:

. ./setdb19_jars.sh ojdbc8.jar       # For WLS
. ./setdb19_jars.sh ojdbc8dms.jar # For FMW

You might want to put an explicit export PRE_CLASSPATH=”literal path string” into startWebLogic.sh and set CLASSPATH=”$PRE_CLASSPATH:$CLASSPATH” for any other scripts used to start WebLogic Server (do whatever it takes to simplify operations).