为什么server=.;uid=sa;pwd=;database=不能连接到数据库 还有没有其他的连接语句

2025-01-03 02:29:04
推荐回答(3个)
回答1:

Connection con;
Statement stmt;
ResultSet rs;
String driver;
String url;
String user;
String pwd;
driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
url = "jdbc:sqlserver://localhost:1433;databaseName=你的数据库名";
user = "用户名";
pwd = "密码";

Class.forName(driver);
System.out.println("driver is ok");
con = DriverManager.getConnection(url,user,pwd);

汉字改一下就好……

回答2:

sqlconnection con=new sqlconnection("server=.;database=shoppingdb;uid=sa;pwd=)

回答3:

server=baixin

你SQL是这名称吗?