This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes using connection pooling with servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "using connection pooling with servlet" Watch "using connection pooling with servlet" New topic

using connection pooling with servlet

Jeff Sunder
Ranch Hand

Joined: Jun 26, 2001
Posts: 47
I am trying to connect to a database through a servlet. I am getting the following error message:

    Error: 500
    Location: /servlet/ProjectRequestProcessingInternal Servlet Error:java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcConnection
    at ConnectionPool.returnConnection(
    at ProjectRequestProcessing.doPost(
    at javax.servlet.http.HttpServlet.service(
    at javax.servlet.http.HttpServlet.service(

    I am not sure what the problem is, primarily because I don't know where the error is occuring. I have a servlet called ProjectRequestProcessing and a helper class called ConnectionPool. But I am not quite sure what the where the problem is occuring. Can any shed some light on this?
    Thanks in advance
P Subramanian

Joined: Jul 18, 2001
Posts: 10
I think the error is with the connection pool class. There is some problem in the casting you have done in the connection pool class. Try to solve it.
A Agrawal
Ranch Hand

Joined: Jul 13, 2001
Posts: 41
I hope you have Your Connection Pool's Java File with you.
refer to its returnConnection() method and check what is on the left hand side of "DriverManager.getConnection() method". I guess the object on left side is of a class which doesn't implement Connection interface.
ref: ConnectionPool.returnConnection(
2) If everything is right there, then plz check in your file where you are calling this function than that may be the place which is causing you trouble.

Amit Agrawal,
New Delhi, India.

Amit Agrawal,<BR>New Delhi, India.
I agree. Here's the link:
subject: using connection pooling with servlet
It's not a secret anymore!