aspose file tools*
The moose likes JDBC and the fly likes jTDS Driver is giving error when connecting to SQL 2000 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jTDS Driver is giving error when connecting to SQL 2000" Watch "jTDS Driver is giving error when connecting to SQL 2000" New topic
Author

jTDS Driver is giving error when connecting to SQL 2000

Ravi Tiruvaipati
Greenhorn

Joined: Aug 27, 2003
Posts: 13
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Ravi,
I'm not familiar with SQL Server, but most databases require a port in the connection string.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ravi Tiruvaipati
Greenhorn

Joined: Aug 27, 2003
Posts: 13
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

Joined: Aug 27, 2003
Posts: 13
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jTDS Driver is giving error when connecting to SQL 2000