• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC connection to SQL Server 2000

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could it be that "DatabasName" is misspelled?
 
Laurent Quenon
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Laurent Quenon
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

- Chris
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic