Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jTDS Driver is giving error when connecting to SQL 2000

 
Ravi Tiruvaipati
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to use jTDS driver 0.9rc1 to connect to SQL 2000 and I am keep getting following error...
java.sql.SQLException: Cannot open database requested in login 'testdb'. Login fails.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:366)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2048)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:1648)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:462)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:274)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:48)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:112)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at SQLTest.main(SQLTest.java:15)

for the code


Can someone help me how to fix this problem.

thanks & regards
ravi
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34974
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravi,
I'm not familiar with SQL Server, but most databases require a port in the connection string.
 
Ravi Tiruvaipati
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,
I tried even with port but I am still getting the error. Infact when create ODBC connection to the same database with same user and password it works fine. I tried jdbc dbc bridge, it works there! I dont know what I am missing here for this jTDS. Looks like it is identifying the database and not able to authenticate the login.

ravi
 
Ravi Tiruvaipati
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem solved! It was issue with roles assigned to the user. I should select only public role to access table owned by 'dbo'. I changed the roles and now it works.

thanks for the effort.
ravi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic