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

Michel started his career as a medical officer in the Royal Dutch Airforce, with a focus on pharma. After the air force, he continued in pharma, followed by time working in clinical pharmacology. While there, he transitioned to IT by learning UNIX and MUMPS, and developed a system for managing patients’ medical records. As his career developed, his responsibility shifted from a deep technical perspective to a more visionary role. At the end of 2011, Michel authored a book on WebLogic Administration for beginners. He joined Qualogy in April 2012 where he expanded his repertoire significantly, serving a wide range of customers with his knowledge about Java Application Servers, Middleware and Application Integration. He also increased his multiple-industry knowledge in his role as Solutions or IT architect by working for customers in a range of sectors, including financials, telecom, public transportation and government organizations. In 2012, he received the IT Industry-recognized title of Oracle ACE for being an ambassador and community leader in his area of expertise. In 2019, this was enhanced to Oracle ACE Director. Michel is asked regularly to speak about technology and the impact of innovation at national and international conferences such as KubeCon, Oracle OpenWorld, Groundbreakers Developers Tours and others. He contributes actively to the OpenSource community and solutions regarding containerization, CI/CD and DevOps. In October 2021, Michel took an exciting step in his career by becoming Business Unit Manager for Qualogy Managed Services. While he still has a finger on the pulse in terms of technology, he is expanding his scope by combining his experience with the new insights gained in his new position. Read more via blog: https://bit.ly/3fAxrqf | Medium: https://mschildmeijer.medium.com/ | Books: Oracle Weblogic Server 11gR1 PS2: Administration Essentials: https://bit.ly/3IhALmf | Oracle WebLogic Server 12c: First Look1: https://bit.ly/31olbpj

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