SQL Driver Java

Microsoft SQL Server JDBC Driver 2.0:

下载地址:http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&FamilyID=99b21b65-e98f-4a61-b811-19912601fdc9

----------------------------------------------------------------------------------------------------------------------

测试代码:

import java.sql.*;
public class MSDBdemo {
public MSDBdemo() {
}
    public static void main(String[] args){
      try {
        Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").
            newInstance();
        System.out.println("数据库驱动程序注册成功!");
        String url =
            "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=master";
        String user = "sa";
        String password = "sa";
        Connection conn = DriverManager.getConnection(url, user, password);
        System.out.println("数据库连接成功");

      }
      catch (Exception e) {
        e.printStackTrace();
        System.out.println("数据库连接失败");
      }

    }
}

 

----------------------------------------------------------------------------------------------------------------------

 

Microsoft SQL Server JDBC Driver 3.0:

下载地址:http://www.microsoft.com/downloads/details.aspx?FamilyID=A737000D-68D0-4531-B65D-DA0F2A735707&displaylang=zh-cn

 

 

你可能感兴趣的:(sql,sql,server,String,Microsoft,sqlserver,数据库驱动程序)