Wednesday, June 27, 2012

Solving Cannot Load Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver In JDeveloper 11g

As last post discussed about how to configure JDeveloper to connect MSSQL Server, it is not enough to run your jsf pages.
To run jsf pages, Integrated WebLogic Server needs to look your sqljdbc4.jar location.
Unless you specify the jar location, you would get "Cannot Load Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver".

Platform - Windows 7 x86 Enterprise
JDeveloper - 11.1.1.3
Weblogic - 10.3.3.0
MSSQL Server 2008 Database

You can do in 3 ways either -
1. By defining Classpath in machine.
 a. In your machine set CLASSPATH variable to pointing the saved jar location.

systemvar






























 b. Click New button in System Variables area & follow screenshot.


classpath






























 c. Click OK to close the dialogs.
 d. Now, upon starting, integratedwls will able to look jar file.


2. By defining jar location in startWeblogic.cmd in IntegratedWLS.
 a.Navigate to C:\Users\ralam\AppData\Roaming\JDeveloper\system11.1.1.3.37.56.60\DefaultDomain\bin .

 b.Open startWebLogic.cmd file & look for "set SAVE_CLASSPATH"(without quotes) or "set
    CLASSPATH" (without quotes) entry.

 c.Put in any entry your jar file location & close to save the file, like this -

startweblogic

3. The last way is to save your jar file at this location in Integrated WLS installation folder -
    C:\Users\ralam\AppData\Roaming\JDeveloper\system11.1.1.3.37.56.60\DefaultDomain\lib\