0

Last time I used SQL with Java/Eclipse I had a SQL script linked to the Project.

This time, I connected to a different server using jdbc format (not localhost) and it connects correctly.

Now I need to get into this specific database named WInfo but I don't know how to do that.

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
c = DriverManager.getConnection("jdbc:sqlserver://serverName:1433/;user=UserName;password=******;");
4

1 回答 1

0

使用以下连接字符串:

 c = DriverManager.getConnection("jdbc:sqlserver://SERVERNAME:PORTNO;databaseName=DATABASENAME;
 user=MyUserName;password=*****");

或者

 c = DriverManager.getConnection("jdbc:sqlserver://SERVERNAME:PORTNO;databaseName=DATABASENAME",
 MyUserName, MyPassword);
于 2013-06-18T14:23:45.300 回答