Servlet: Problem connecting database
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
Re: Servlet: Problem connecting database
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
Re: Servlet: Problem connecting database
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
[email protected]
Re: Servlet: Problem connecting database
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.