Category Archives: weblogic

Install MySQL jdbc driver on Oracle Weblogic

Oracle Weblogic comes with the Oracle jdbc drivers bundled (indeed), but if we have to access a database from some other vendor, we will have to install the drivers separately. Due to the acquisition of Sun by Oracle (and MySQL with it), we should expect at least the MySQL driver in the next releases, but for now we will have to go through a manual install. We will explain how to install it in this tutorial.

For this tutorial I have used Oracle Weblogic 12c and MySQL jdbc driver, but should work with any jdbc vendor.

First, we will download the jdbc connector from this link (registration needed)

After that, we copy the jar to the server classpath, the path should be:

{ORACLE_HOME}/Middleware/oracle_common/lib/java

Now we will edit the startup script, so when we start the server it loads the driver. We will have to edit the following script:

{ORACLE_HOME}/Middleware/user_projects/domains/{DOMAIN_NAME}/bin/setDomainEnv.sh

Now, we locate the following lines, and add mysql.jar as shown:


if [ "${POST_CLASSPATH}" != "" ] ;

then

POST_CLASSPATH="${CLASSPATHSEP}${POST_CLASSPATH}:${COMMON_COMPONENTS_HOME}/lib/java/mysql.jar"

export POST_CLASSPATH

else

POST_CLASSPATH="${COMMON_COMPONENTS_HOME}/lib/java/mysql.jar"

export POST_CLASSPATH

fi

Now we just only have to restart the server, and we are done!