应该是没有找到驱动 1. Setting the Classpath The SQL Server 2000 Driver for JDBC needs to be defined in your CLASSPATH variable. The CLASSPATH is the search string that your Java Virtual Machine (JVM) uses to locate the JDBC drivers on your computer. If the drivers are not on your CLASSPATH, you receive the error "class not found" when trying to load the driver. Set your system CLASSPATH to include the following entries, where install_dir is the path to your SQL Server 2000 Driver for JDBC installation directory: install_dir/lib/msbase.jar install_dir/lib/msutil.jar install_dir/lib/mssqlserver.jar Windows Example CLASSPATH=.;c:\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;c:\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;c:\Microsoft SQL Server 2000 Driver for JDBC \lib\mssqlserver.jar UNIX Example CLASSPATH=.;/home/user1/mssqlserver2000jdbc/lib/msbase.jar;/home/user1/mssqlserver2000jdbc/lib/msutil.jar;/home/user1/mssqlserver2000jdbc/lib/mssqlserver.jar 2. Registering the Driver Registering the driver tells the JDBC driver manager which driver to load. When loading a driver using class.forName(), you must specify the name of the driver: com.microsoft.jdbc.sqlserver.SQLServerDriver For example: Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
1. Setting the Classpath
The SQL Server 2000 Driver for JDBC needs to be defined in your CLASSPATH variable. The CLASSPATH is the search string that your Java Virtual Machine (JVM) uses to locate the JDBC drivers on your computer. If the drivers are not on your CLASSPATH, you receive the error "class not found" when trying to load the driver. Set your system CLASSPATH to include the following entries, where install_dir is the path to your SQL Server 2000 Driver for JDBC installation directory: install_dir/lib/msbase.jar
install_dir/lib/msutil.jar
install_dir/lib/mssqlserver.jar Windows Example
CLASSPATH=.;c:\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;c:\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;c:\Microsoft SQL Server 2000 Driver for JDBC
\lib\mssqlserver.jar UNIX Example
CLASSPATH=.;/home/user1/mssqlserver2000jdbc/lib/msbase.jar;/home/user1/mssqlserver2000jdbc/lib/msutil.jar;/home/user1/mssqlserver2000jdbc/lib/mssqlserver.jar 2. Registering the Driver
Registering the driver tells the JDBC driver manager which driver to load. When loading a driver using class.forName(), you must specify the name of the driver: com.microsoft.jdbc.sqlserver.SQLServerDriver For example: Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");