what I use is SQL SERVER 2000,the system is WINXP SP-2
I set the classpath:C:\Borland\JBuilder2005\jdk1.4\lib;.;C:\Program Files\Tomcat 5.0\common\lib;.;
I use the JDBC-ODBC to connect the database,the original code is
package hospital.db;
import java.sql.*;
import hospital.db.*;
public abstract class DBConnection
{
private static Connection conn = null;
public static Connection getConnection()
{
try
{
if(conn == null)
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:shujuku","sa","");
System.out.println("Connection created.");
}
else
{
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select count from administrator");
if(rs == null || !rs.next())
{
Class.forName("san.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:shujuku","sa","");
System.out.println("Connection re-created.");
}
}
catch(Exception ex)
{
System.out.println(ex);
}
finally
{
return conn;
}
}
}
there is no problem in connection the database:Connection created. 2006-04-12 11:34:33
but when I put it into the Tomcat 5.0,it always throw something like:
sun.jdbc.odbc.JdbcOdbc.createSQLException() Ln6958[Microsoft][ODBC SQL Server Driver]