Saturday, September 13, 2014

Oracle SOA / Weblogic 12C - Register new JDBC drivers

We had a requirement to connect to MS SQL server from Oracle SOA Suite 12C using the microsoft JDBC type 4 driver. But while creating the JDBC connection from weblogic console using the ANY type driver available with 12C it was throwing the below error.

Cannot load driver: com.microsoft.jdbc.sqlserver.SQLServerDriver 

As a workaround we wanted to register  Microsoft’s SQL SERVER Driver (Type 4) Version: 2005 and later. Below are the steps we used to register the missing driver. Although weblogic comes with most of the drivers by default, We can register any third party driver supported by weblogic using the below steps.

Oracle SOA 12C connect to MS SQL server

1. Download the Microsoft JDBC driver  for MS SQL server (sqljdbc4.jar) from http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx

2.Copy the jar file to the weblogic lib folder ${WL_HOME}/SERVER/lib.The jar file should be available in all the managed servers to which the datasource will be targeted.

3.Add the path to the WEBLOGIC_CLASSPATH in the commEnv.sh located in the ${WL_HOME}/common/bin/commEnv.sh. You can verify if the jar was included to calsspath in the logs during server start up. 

4. To update the list of drivers weblogic navigate to ${WL_HOME}/server/lib and add the below entry to the jdbcdrivers.xml.

<Driver
Database="MS SQL SERVER"
Vendor="Microsoft"
Type="Type 4"
DatabaseVersion="2005 and later"
ForXA="false"
ClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
URLHelperClassname="weblogic.jdbc.utils.MSSQL2005JDBC4DriverURLHelper"
TestSql="SELECT 1">
<Attribute Name="DbmsName" REQUIRED="false" InURL="true"/>
<Attribute Name="DbmsHost" REQUIRED="true" InURL="true"/>
<Attribute Name="DbmsPort" Required="true" InURL="true" DefaultValue="1433"/>
<Attribute Name="DbmsUsername" Required="true" InURL="false"/>
<Attribute Name="DbmsPassword" Required="true" InURL="false"/>

</Driver>

Restart the servers and the new driver should be available as below.


4 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hi,
    Could you please elaborate point no. 3 which states, ”Add the path to the WEBLOGIC_CLASSPATH in the commEnv.sh located in the ${WL_HOME}/common/bin/commEnv.sh. You can verify if the jar was included to classpath in the logs during server start up”. The commEnv.sh file is almost blank in my case so don’t know how to add the class path.

    ReplyDelete
    Replies
    1. It was moved to {WL_HOME}/oracle_common/common/bin/commEnv.sh

      Delete
  3. Our Ecommerce Website Design and Development Services give finish answer for producing on the web deals to our customers. Proficient Design and Commercial comprehension will produce more ROI. Follow Me Drone

    ReplyDelete