weblogic建立SQLServer数据库连接池时,可以使用jtds驱动。具体配置方法如下:
1,在startWebLogic.cmd的CLASSPATH中增加jtds.jar的物理路径
2,启动weblogic服务
3,进入控制台,新建连接池:
Database Type选择other;
Driver Classname设置为:net.sourceforge.jtds.jdbc.Driver
URL设置为:
jdbc:jtds:sqlserver://192.168.0.188:1433;user=sa;password=123456;databaseName=pubs
红色部分根据实际情况进行设置。
出现的异常
1. Cannot load driver class: net.sourceforge.jtds.jdbc.Driver
找不到驱动包,解决方案:把驱动包拷贝到具体发布域中的lib中
如jtds-1.2.jar拷贝到 C:/bea/user_projects/domains/base_domain/lib
2.weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property
weblogic 和jtds兼容性问题
解决方案:要将ntlmauth.dll 分别拷贝入
C:/WINDOWS
C:/WINDOWS/SYSTEM
C:/WINDOWS/SYSTEM32
目录下
URL一定要设置为jdbc:jtds:sqlserver://192.168.0.188:1433;user=sa;password=123456;databaseName=pubs
不能用
jdbc:jtds:sqlserver://localhost:1433/pubs 因为other驱动无法找到对应的填入的验证
3 如果系统使用Hibernate3,则可能会遇到以下异常:
weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: Network error IOException: Connection refused: connect
Hibernate从3.0开始就采用了新的基于ANTLR的查询翻译器,而在WebLogic中使用的是antlr.jar不是最新版本,无法满足该要求
最简单的方法就修改spring配置如下