Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot load driver: com.microsoft.sqlserver.jdbc.SQLServerDriver weblogic 10g

I'm trying to create a datasource from weblogic 10.3 to sqlserverexpress 2008 r2, but when I test the connection, the following message appears :

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

What should I do?

like image 551
Manuel Avatar asked Aug 01 '11 22:08

Manuel


People also ask

Why can't I connect to SQL Server using the JDBC driver?

If you have problems connecting to SQL Server using the JDBC driver, see Troubleshooting Connectivity for suggestions on how to correct it. The simplest approach to creating a connection to a SQL Server database is to load the JDBC driver and call the getConnection method of the DriverManager class, as in the following:

How to add JDBC drivers to WebLogic Server?

You can get the JAR file from msdn.microsoft.com/en-us/sqlserver/aa937724 To use third-party JDBC drivers that are not installed with WebLogic Server, you can add them to the DOMAIN_HOME/lib directory, where DOMAIN_HOME represents the directory in which the WebLogic Server domain is configured.

What languages is Microsoft JDBC driver for SQL Server available in?

This release of Microsoft JDBC Driver for SQL Server is available in the following languages: Microsoft JDBC Driver 9.4.1 for SQL Server (zip): Chinese (Simplified) | Chinese (Traditional) | English (United States) | French | German | Italian | Japanese | Korean | Portuguese (Brazil) | Russian | Spanish

Which SQL Server Driver to use with Oracle?

Opening a ticket with Oracle, the recommendation was to use a different driver for the data server, com.microsoft.sqlserver.jdbc.SQLServerDriver. That worked.


3 Answers

You need to add the sqlserver JDBC driver jar file to the weblogic classpath.

like image 194
Femi Avatar answered Sep 30 '22 06:09

Femi


From weblogic 1221 documentation here :

To use third-party JDBC drivers that are not installed with WebLogic Server, you can add them to the DOMAIN_HOME/lib directory, where DOMAIN_HOME represents the directory in which the WebLogic Server domain is configured. The default path is ORACLE_HOME/user_projects/domains. For more information, see "Adding JARs to the Domain /lib Directory" in Developing Applications for Oracle WebLogic Server.

This solution seems better than updating the weblogic class path, as it will impact the other domains. For example say two domains want to use different versions of the jdbc driver. In this case updating the class path through commEnv.cmd might case issues. Of course the flip side would be that you have to place/link the driver jars in both the domian's lib directory.

like image 30
asboree Avatar answered Sep 30 '22 05:09

asboree


I add sqljdbc4.jar to %WLHome%/Server/Lib and i add the following line to the weblogic_classpath in %WLHome%\common\bin\commEnv.cmd: ";%WL_HOME%\server\lib\sqljdbc4.jar"

like image 36
Manuel Avatar answered Sep 30 '22 06:09

Manuel