Click to See Complete Forum and Search --> : Servlet: Problem connecting database


September 23rd, 1999, 01:46 PM
I am trying to connect to database using JdbcOdbc driver in the init mathod of a Servlet. I have tested the connection writting a test java code. Connection is ok. But while executing Servlet it gives error:

SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
===================================

con = DriverManager.getConnection"jdbc:odbc:MPRDB","tstmgr", "pass");

==================================

Help me

-Kaushik

amaresh
October 7th, 1999, 01:15 PM
Can you post the sequence of exceptions? (the chain of nested exceptions traced up to your function call).
The immediate thing that I can think of is, check your DSN to make sure if it is okay. However, since you say you tried a test program and it works, it is unlikely to have any problem with data source.
-Amaresh

January 31st, 2000, 02:55 AM
Hi!
I am also facing the same problem. I think it is due to configuration. I am using IIS Web Server , JRUN engine. If your problem
is solved? can you please let me know also. It will be realy helpfull for me. sice i am trying this for past two days.

Regards
Sami

sami_ulla@yahoo.com

January 31st, 2000, 09:06 AM
In "con = DriverManager.getConnection"jdbc:odbc:MPRDB","tstmgr", "pass");"
Put a parenthesis after getConnection. It must have have been a typo but just in case....
Which database are you connecting to ? If you connect to MS Access, say, then you will have to create a profile in the ODBC datasource on the server where you are keeping the servlet.(I presume you are using a NT Server) Did you create a profile for MPRDB ?
Give the exact piece of code that you are using to connect to the database (class.forName(..), con = DriverManager.get...) and the exception messages.