Hello, When I try to connect to a SQL Server database installed locally on my computer with the piece of code you can find below, I always receive a SQLException ("[Microsoft][SQLServer 2000 Driver for JDBC]Connection reset") Here is the code, it seems that the exception is thrown by the DriverManager.getConnection. ... Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabasName=VolleyManagement_Draft"); return con; Can someone help me? Thx a lot.
Thx for your valuable remark, but it's not that. I probably made a mistake during my several tries, but now it's corrected and it's still the same error. Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=VolleyManagement_Draft"); return con; Any ideas?
Originally posted by Laurent Quenon: Thx for your valuable remark, but it's not that.
I am a master of the obvious. How about using the DriverManager.getConnection(url, user, pwd) method, using a username and a password? I believe the default user for SQL Server is "sa" and a blank password.
Hi, Try this...I think it will work. Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); url="jdbc:microsoft:sqlserver://OM-KL9W08EZQ2ZX:1433;DatabaseName=emp"; userName="sa"; pwd="sa"; Connection connection=DriverManager.getConnection(url,userName,pwd); Bye.
posted 14 years ago
Thanks a lot... indeed it was better, because now my program is at least connecting, but now I receive another exception "The user is not associated with a secure connection to SQL Server". The user I'm using for that connection is "SA" so I really don't understand. Any ideas...
I've run into this exact problem also. On our server, the issue was the security mode. It was set for "Windows Only", we changed it to "SQL Server and Windows"; which enabled us to log in using the "sa" account (and other accounts also). The setting can be found by going into the Enterprise Manager, properties on the server and the security tab.