File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

Nirmal,
Glad to hear it is working. Thanks for sharing the solution with us.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: J2EE server not connecting to database