Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); 
Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.0.9:1433;user=sa;password=sa;DatabaseName=testDb");

解决方案 »

  1.   

    Microsoft SQL Server 2000 Driver for JDBC
    (http://www.microsoft.com/downloads/release.asp?releaseid=38312)
      

  2.   

    http://msdn.microsoft.com/MSDN-FILES/027/001/779/JDBCRTMReleaseMa
    nifest.htm 
    1. Download theMicrosoft SQL Server 2000 Driver for JDBC (setup.exe file) from
    the Microsoft MSDN Web site at
    http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/
    sample.asp?url=/MSDN-FILES/027/001/779/msdncompositedoc.xml.
    Save the file in a temporary directory on your local computer.
    2. Run setup.exe from the temporary directory and follow the instructions on the
    screen.
    3. Add the path to the following files to your CLASSPATH:
    " install_dir/lib/msbase.jar
    " install_dir/lib/msutil.jar
    " install_dir/lib/mssqlserver.jar
    Where install_dir is the folder in which you installed the driver. For
    example:
    set CLASSPATH=install_dir\lib\msbase.jar;
    install_dir\lib\msutil.jar;install_dir\lib\mssqlserver.jar;
    %CLASSPATH%DriverName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
    URL="jdbc:microsoft:sqlserver://lcdbnt4:1433"
      

  3.   

    如果用JRUN可以用自带的JDBC比较方便