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 using connection pooling with servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "using connection pooling with servlet" Watch "using connection pooling with servlet" New topic
Author

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:

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

    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
Greenhorn

Joined: Jul 18, 2001
Posts: 10
Hi,
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.
Subramanian
A Agrawal
Ranch Hand

Joined: Jul 13, 2001
Posts: 41
I hope you have Your Connection Pool's Java File with you.
1)
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(ConnectionPool.java:180)
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: http://aspose.com/file-tools
 
subject: using connection pooling with servlet