问题
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?
回答1:
You need to add the sqlserver JDBC driver jar file to the weblogic classpath.
回答2:
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"
回答3:
add "sqljdbc.jar" file to the weblogic classpath
To download go to http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
回答4:
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.
回答5:
For some reasons, the above answers did not work for me so I ended up choosing Oracle MS SQL Server Driver instead of the one of Microsoft. See : http://i.imgur.com/s9sr5xs.jpg
Then if you have trouble with the instance name, you can try specifying the port instead. To get the port number, open Sql Server Configuration Manager : SQLServerManager11.msc
来源:https://stackoverflow.com/questions/6905156/cannot-load-driver-com-microsoft-sqlserver-jdbc-sqlserverdriver-weblogic-10g