Tomcat5.5.17+SQl Server2000 數(shù)據(jù)池
我的tomcat5.5.17 三個jar包已放入D:\AnZhuan\Tomcat 5.5\common\lib中
在D:\AnZhuan\Tomcat 5.5\conf下建了個bbs.xml 內(nèi)容如下: <Context path="/bbs" docBase="D:\AnZhuan\Tomcat 5.5\conf" debug="5" reloadable="true"> <Resource name="jdbc/TestDB" type="javax.sql.DataSource" maxActive="10" maxIdle="3" maxWait="10000" username="sa" password="123" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" url="jdbc:microsoft:sqlserver://localhost;DatabaseName=bbs"/> </Context> 我的項目中的web.xml內(nèi)容如下: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java./xml/ns/j2ee" xmlns:xsi="http://www./2001/XMLSchema-instance" xsi:schemaLocation="http://java./xml/ns/j2ee http://java./xml/ns/j2ee/web-app_2_4.xsd"> <description>SQL Test App</description> <resource-ref> <description>test</description> <res-ref-name>jdbc/TestDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </web-app> 現(xiàn)在報:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class ‘‘ for connect URL ‘null‘ 驅(qū)動我已裝了,配了為什么還報這種錯呢??? 我又寫了一個java文件做測試如下: import java.sql.*; public class aaa { public static void main(String[] args) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn=DriverManager.getConnection("jdbc:odbc:bbs","sa","sa"); if(conn==null){ System.out.println("null"); } else{ System.out.println("ok"+conn); } conn.close(); } catch (Exception e) { e.getMessage(); } } } 結(jié)果為:oksun.jdbc.odbc.JdbcOdbcConnection@1d58aae 我實在沒執(zhí)了,希望大家該出手時就出手,救救我吧! wjg_1314 發(fā)表于 2006-7-16 9:17:41
搞了快兩天了。暈悶啊。 msutil.jar mssqlserver.jar msbase.jar 這三個包不錯吧。 liaoxiaoqi 發(fā)表于 2006-7-16 20:22:08
一、SQLserver打上sp3或者sp4補丁。 二、D:\AnZhuan\Tomcat 5.5\conf\server.xml中添加或者修改: <Context path="/bbs" docBase="D:\AnZhuan\Tomcat 5.5\conf" debug="5" reloadable="true"> <Resource name="jdbc/TestDB" type="javax.sql.DataSource" maxActive="10" maxIdle="3" maxWait="10000" username="sa" password="123" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" url="jdbc:microsoft:sqlserver://localhost;DatabaseName=bbs"/> </Context> |
|