Configure WLS 11g for MS SQL Server
Published on: Author: Michel Schildmeijer Category: OracleWebLogic 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.
Hi,
At weblogic 12.2.1.3 I've just uploaded the jar file to the lib und Domains root folder.
tks