我的tomcat5.5.17 三個(gè)jar包已放入D:\AnZhuan\Tomcat 5.5\common\lib中
在D:\AnZhuan\Tomcat 5.5\conf下建了個(gè)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>
我的項(xiàng)目中的web.xml內(nèi)容如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/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)在報(bào):org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class ‘‘ for connect URL ‘null‘
驅(qū)動(dòng)我已裝了,配了為什么還報(bào)這種錯(cuò)呢???
我又寫了一個(gè)java文件做測(cè)試如下:
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
我實(shí)在沒執(zhí)了,希望大家該出手時(shí)就出手,救救我吧!
wjg_1314 發(fā)表于 2006-7-16 9:17:41
搞了快兩天了。暈悶啊。
msutil.jar mssqlserver.jar msbase.jar
這三個(gè)包不錯(cuò)吧。
liaoxiaoqi 發(fā)表于 2006-7-16 20:22:08
一、SQLserver打上sp3或者sp4補(bǔ)丁。
二、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>