wood burning stoves 2.0*
The moose likes JDBC and the fly likes J2EE server not connecting to database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "J2EE server not connecting to database" Watch "J2EE server not connecting to database" New topic
Author

J2EE server not connecting to database

Nirmal JeyaChandra
Greenhorn

Joined: Aug 31, 2005
Posts: 25


The above is my code which works using Tomcat Server, but while using J2EE server it gives error message as client code at null in the command prompt.
Please help me. Thank you in advace.

Nirmal Jeya Chandra

[edited to add code tags]
[ October 09, 2005: Message edited by: Jeanne Boyarsky ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30067
    
149

Nirmal,
Welcome to JavaRanch!

What error message are you getting in the logs? I suspect it is a classpath issue if it works in one server and not another. Double check the JDBC driver is in your classpath.

I recommend changing the code to do everything in one try/catch block. If you can't load the driver, do you really want to attempt a database connection? This leads to confusing error messages.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Nirmal JeyaChandra
Greenhorn

Joined: Aug 31, 2005
Posts: 25
Thanks a lot for your reply.

Actually, I did not place the class file, which has the JDBC statements in the j22ee/lib/classes folder. This was the mistake.

Now I got the database connectivity. Everything is working fine.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30067
    
149

Nirmal,
Glad to hear it is working. Thanks for sharing the solution with us.
 
jQuery in Action, 2nd edition
 
subject: J2EE server not connecting to database
 
Similar Threads
ClassNotFoundException
Help me in clearing the Errors!
How to perform MultiTask in a Servlet
in which method shuld i use at the servlet code for request
mysql refused rmi connection