81,092
社区成员
发帖
与我相关
我的任务
分享
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Test {
public static void main(String[] args) throws SQLException {
Connection con;
PreparedStatement pre;
ResultSet re;
try{ Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String uri="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Mumber";
con = DriverManager.getConnection(uri,"sa","123456");
System.out.println("连接成功");}
catch(Exception e){
System.out.println(""+e);
}
}
}