permaculture playing cards
The moose likes JDBC and Relational Databases and the fly likes jdbc connection to mssql2000 db server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "jdbc connection to mssql2000 db server" Watch "jdbc connection to mssql2000 db server" New topic

jdbc connection to mssql2000 db server

mohan kannan

Joined: Dec 02, 2001
Posts: 26
Hi all
I am using jdbc-odbc driver to connect to mssql2000 database.
The code used is below

I have tested this code local system with "sa" rights (default user name and password) and works successfully for creating table, adding,listiing recpords.
But when uploading the files on server (Tomcat4.0.1) with exact user name and password provided by server administrator, and when run the related jsp's involving db connection, I am getting the following error
Error Number. 2 : SQLException: Could not connect to DB
Please suggest what's the problem.
pl suggest Whether sun.jdbc.odbc.JdbcOdbcDriver can be used on the web server?
Server administrator says the dsn is configured properly and user name and password are correct.
Thanks in advance
[ Edited by Dave to format code and remove the UBB smilies ]
[ February 04, 2002: Message edited by: David O'Meara ]
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Doesn't seem like you're finding enough information. Have you tried printing cnfe.getMessage()?
I'd rethrow the same exception rather than throwing it with a new message, you're losing the original.

Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Try printing the venor error code too, that might give you a clue if it a SQL Server problem.

I agree. Here's the link:
subject: jdbc connection to mssql2000 db server
It's not a secret anymore!