Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

establishing connection to mssql2000

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to establish connection to mssql2000 on server through JSP
Server Tomcat
The code used in jsp is

It's loading the driver and "JDBC Driver Loaded " message received
I have properly replaced dsnname, username and password in url string with the exact dsn details provided by
my system administrator.
But when trying to get connection the server output is
Hello loading and connecting to dB
JDBC Driver Loaded
Error Number. 2 : SQLException: Could not connect to dB
Error Message is [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Error Code is 0
Error State is IM002
The above error received for the both url formats
The same code /jsp file when run on local machine (mssql7 and tomcat 4.0.1) with the same dsn name properly configured
(Here I used user name="sa" and password="") is able to establish connection to database.
System administrator says that the dsn is configured properly on the server.
Please indicate whether the problem is with the code or the dsn is not properly configured at the server
thanks
Mohan
[ Edited by Dave to format code and fix smilies ]
[ April 09, 2002: Message edited by: David O'Meara ]
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The correct way of using Class.forName is
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver:DSNName");
out.println("JDBC Driver Loaded");
Thanks
Sanjay
[ Edited by Dave to fix problem ]
[ April 09, 2002: Message edited by: David O'Meara ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Shivade Sanjay:
The correct way of using Class.forName is
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver:DSNName");
out.println("JDBC Driver Loaded");


Not true, you are confusing class names and JDBC URLs.
Class.forName expects the "fully qualified name of the desired class" - adding the DNS to the end is not correct.
Dave
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic