i am having doubt on tomcat using jdbc odbc bridge driver to connect to SQl Server database i am using tomcat 6.0 and jdk 1.6.0_01 i have created a jsp in which i am connecting to my database as below
i am working on this code for a long time but have no solutions to it.
everytime i run i am getting
error=java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
is there anything i need to change in Tomcat so that it can get jdbc/odbc driver........and later connect to my database.
because there is nothing wrong with my dsn i am sure as i have checked it when i call the same code for connection above in a simple java program it works it connects to database and executes query but it is not working with tomcat........
If you're creating your connections right in your classes, Tomcat will have nothing to do with whether it works or not.
As long as Tomcat can see your JDBC driver (in this case the JDBC-ODBC driver) you should be able to connect with it.
You already have log thread in the servlets forum on this topic and I'd like to avoid seeing another, parallel one here. If this were my problem, I would put Tomcat aside for a minute and try connecting to your database from a plain old Java class. Once you can do that, start working on getting it to work from within your container.
i sincerely apologise for reposting the same topic what actualy i thought was since my java code for connection works in a normal java program why not in Tomcat 6.0
so may be if some configurations are required in Tomcat 6.0.(Server.xml,web.xml)..since my Tomcat does not have access to jdbc/odbc driver it shows from Exception thrown so furthur how can it connect to my database thats why i switched here........with a fresh topic
i apologise once again will not at all post on this topic any furthur
[ January 30, 2008: Message edited by: dhwani mathur ]
You don't need to configure anything in your web.xml file if you are creating the connections from your Java class directly. If you were using Tomcat's container managed connection pooling, then you would.
What errors are you seeing?
PS: Since this is working from a plain old Java class, it looks like you just need to insure that the driver visible to the container. I'm going to close the thread in servlets to insure that this conversation doesn't get spread out too thin.
Joined: May 08, 2007
Thanks for the response
First of all,i am not creating my connection from java class,i am creating my connection from JSP scriplet <% connection to database code here%>
Since i am a beginner i dont have any idea on Tomcats container managed connection pool.
and in my server logs i am getting these exceptions