This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Why my JDBC not working in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Why my JDBC not working in servlet" Watch "Why my JDBC not working in servlet" New topic

Why my JDBC not working in servlet

Ming Chen

Joined: Mar 14, 2002
Posts: 13
My JDBC connection with MySQL has been always working on general java classes on command line, but when I call a class(JDBC) from servlet, there is always a connection problem. I check all classpath, it was right. I don't know if I should do sth with web.xml file, I use Tomcat 4.0.
Anybody know how?
Ming Chen

Joined: Mar 14, 2002
Posts: 13

I have solved this problem.
I add MySQL driver mm.mysql-2.0.4-bin.jar file on the tomcat folder:
D:\Apache Tomcat 4.0\common\lib, restart tomcat server, it then works.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Glad you solved it
This is quite a common problem when connecting databases to Servlet Engines.
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Why my JDBC not working in servlet
It's not a secret anymore!