Java mewbe/student - ms sql connectionstring login failed for user [message #1717945] |
Thu, 17 December 2015 23:22  |
Eclipse User |
|
|
|
I'm trying to make a program to connect to a remote ms sql database to test and learn how to using the following code.
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://my.server.com;Initial" +
"Catalog=test2;Persist Security Info=True;User ID=rsmobile;Password=xxxx";
// Declare the JDBC objects.
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
// Establish the connection.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection(connectionUrl);
I may have something wrong in my syntax. I can connect to the table from ms ssms. The database name is test2 and the table name is TestTable2. I get the following error.
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ''. ClientConnectionId:
Thanks
|
|
|
|
Powered by
FUDForum. Page generated in 0.08433 seconds