This chapter describes how to set up and use JDBC drivers with WebLogic Server 12.1.3.
This chapter includes the following sections:
WebLogic Server provides support for application data access and database dependent features. For more information, see "Database Interoperability" in What's New in Oracle WebLogic Server.
The 12c version of the Oracle Thin driver is installed with Oracle WebLogic Server.
ojdbc7.jar
, ojdbc7_g.jar
, and ojdbc7dms.jar
for JDK7
ojdbc6.jar
, ojdbc6_g.jar
, and ojdbc6dms.jar
for JDK 6
Note:
WebLogic-branded DataDirect drivers are also installed with WebLogic Server. See Using WebLogic-branded DataDirect Drivers for more information.In addition to the Oracle Thin Driver, the mySQL 5.1.x (mysql-connector-java-commercial-5.1.22-bin.jar
) JDBC driver is installed with WebLogic Server.
These drivers are installed in subdirectories of $ORACLE_HOME/oracle_common/modules
. The manifest in the weblogic.jar
file directly or indirectly includes these files so they load automatically when the server starts. Therefore, you do not need to add these JDBC drivers to your CLASSPATH
. For the Oracle driver, the default is to include ojdbc7.jar
. If you plan to use a different version of any of the drivers installed with WebLogic Server, see Adding or Updating JDBC Drivers.
Note:
WebLogic Server includes a version of the Derby DBMS installed with the WebLogic Server examples in theWL_HOME\common\derby
directory. Derby is an all-Java DBMS product included in the WebLogic Server distribution solely in support of demonstrating the WebLogic Server examples. For more information about Derby, see http://db.apache.org/derby
.If you plan to use a third-party JDBC driver that is not installed with WebLogic Server, you must install the driver files by updating your CLASSPATH
with the path to the driver files. See Adding or Updating JDBC Drivers.
For information on supported JDBC drivers, see "Supported Configurations" and "Database Interoperability" in What's New in Oracle WebLogic Server.
Note:
It is recommended to update the JDBC drivers using the OPatch.To add a new or update an existing JDBC driver:
If you are updating existing JDBC drivers, make backup copies of the corresponding JAR files. Drivers installed with WebLogic Server are located in subdirectories of the $ORACLE_HOME/oracle_common/modules
directory.
In the appropriate location, add the new driver JAR or replace the existing JAR with the updated JAR.
Determine if you need to modify your CLASSPATH
:
If the JDBC driver JAR was installed with WebLogic Server and the replacement JAR has the same name, you do not need to modify CLASSPATH
. The manifest in the weblogic.jar
file directly or indirectly includes these files so they will load automatically when the server starts.
If you are adding a new JDBC driver or updating a JDBC driver where the replacement JAR has a different name than the original JAR:
For all domains, edit the commEnv.cmd/sh
script in WL_HOME
/common/bin
and prepend your JAR file to the WEBLOGIC_CLASSPATH
environment variable. Your JAR must be located before any client JAR files.
For a specific WebLogic Server domain, edit the setDomainEnv.cmd/sh
script in that domain's bin
directory, and prepend the JAR file to the PRE_CLASSPATH
environment variable. Your JAR must be located before any client JAR files.
Note:
setDomainEnv
is designed to be sourced from other scripts, such as the startWebLogic
script. setDomainEnv
should not be called directly from within an interactive shell. Doing so can cause unpredictable issues in the domain.For globalization support with the Oracle Thin driver, Oracle supplies the orai18n.jar
file, which replaces nls_charset.zip
. If you use character sets other than US7ASCII
, WE8DEC
, WE8ISO8859P1
and UTF8
with CHAR
and NCHAR
data in Oracle object types and collections, you must include orai18n.jar
and orai18n-mapping.jar
in your CLASSPATH
.
The orai18n.jar
and orai18n-mapping.jar
are included with the WebLogic Server installation in the ORACLE_HOME
\oracle_common\modules\oracle.nlsrtl_12.1.0
folder. These files are not referenced by the weblogic.jar manifest
file, so you must add them to your CLASSPATH
before they can be used.
The ORACLE_HOME
\oracle_common\modules\oracle.jdbc_12.1.0
folder includes the ojdbc6_g.jar
(for JDK 6) file and ojdbc7_g.jar
(for JDK7), which are the versions of the Oracle Thin driver with classes to support debugging and tracing. To use the Oracle Thin driver in debug mode, add the path to these files at the beginning of your CLASSPATH
.