Configure WLS 11g for MS SQL Server

Configure WLS 11g for MS SQL Server

Published on: Category: Oracle

WebLogic Server supports many different types of databases, and offers even support for Open Source. This is a short blogpost about how to make a datasource connection with a MS SQL Server database version 7, using the open source driver net.sourceforge.jtds.jdbc.Driver. jTDS gives good performance for both SQL Server and Sybase.

1. Upload the jtds jar package to the WLS Host

The jtds-1.2.1.jar is an open source Java (type 4) JDBC 3.0 driver for Microsoft SQL Server (6.5, 7, 2000 and 2005) and Sybase (10, 11, 12, 15), compatible with WLS 11g.

You can download it from http://jtds.sourceforge.net/

Upload it to your WebLogic Server host and place it under the WebLogic Server home,
wlserver_10.3/server/lib.

2. Load the driver in your WLS Server’s CLASSPATH

Navigate to the WebLogic Server home, common/bin, and edit the commEnv.sh (note do not copy and paste this because it contains white-spaces!)

# set up WebLogic Server’s class path
WEBLOGIC_CLASSPATH="${JAVA_HOME}/lib/tools.jar
${CLASSPATHSEP}${WL_HOME}/server/lib/weblogic_sp.jar
${CLASSPATHSEP}${WL_HOME}/server/lib/weblogic.jar
${CLASSPATHSEP}${FEATURES_DIR}/weblogic.server.modules_10.3.5.0.jar
${CLASSPATHSEP}${WL_HOME}/server/lib/webservices.jar
${CLASSPATHSEP}${WL_HOME}/server/lib/jtds-1.2.1.jar${CLASSPATHSEP}${ANT_HOME}/lib/ant-all.jar${CLASSPATHSEP}${ANT_CONTRIB}/lib/ant-contrib.jar"
export WEBLOGIC_CLASSPATH

Restart your AdminServer to reflect these changes

3. Create a datasource to your MS SQL Database

In your Admin Console create a new datasource to the MS SQL database. Use for database type MS SQL Server.

Use ‘Other’ for Database Driver.

Leave the transaction details on the next page as default and click next.

Fill in your database details.

On the next page fill in:

• The driver class name : net.sourceforge.jtds.jdbc.Driver
• Connection URL:
jdbc:jtds:sqlserver://<MS SQL Host>;instance=<MS SQL Instance>;DatabaseName=<Name of MS SQL Database>

Click on Test Configuration, the connection should be successful.

Target the datasource to the proper managed server instance(s) and click finish.

Easy does it!

Instead of adding it to the Server CLASSPATH, you might also consider to upload the jar file to your Domains root folder and place it under lib. Then it also loads after startup. But for a more consistent solution (to my opinion) add as described above.

Michel Schildmeijer
About the author Michel Schildmeijer

Having made his start in the pharmacy sector, Michel transitioned to IT in 1996, working on a UNIX TTY terminal-based system and the MUMPS language. He currently works as a solutions architect at Qualogy, with a focus on middleware, application integration and service-oriented architecture. His passion for middleware started in 2000 when working as a support analyst for a financial institute with BEA WebLogic and Tuxedo. Michel is an expert on the WebLogic platform. He serves customers in his role as architect and advises them in all aspects of their IT landscape. He became an Oracle ACE in 2012 and wrote two books about WebLogic: Oracle WebLogic Server 11gR1 PS2: Administration Essentials and Oracle WebLogic Server 12c: First Look. He is a well-known speaker at national and international conferences and is recognised as an official Oracle Speaker. Read his blog: https://community.oracle.com/blogs/mnemonic

More posts by Michel Schildmeijer
Comments (1)
  1. om 19:07

    Hi,

    At weblogic 12.2.1.3 I've just uploaded the jar file to the lib und Domains root folder.

    tks

Reply