作者在 2018-05-11 21:28:18 发布以下内容
import java.sql.*;
public class Test {
public static void main(String[] srg) {
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=master";
String userName = "sa";
String userPwd = "111111";
Connection dbConn;
try {
Class.forName(driverName);
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
System.out.println("==========数据库连接成功========!");
}catch (Exception e) {
e.printStackTrace();
}
}
}