File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Connection Pooling Problem 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 "Connection Pooling Problem" Watch "Connection Pooling Problem" New topic

Connection Pooling Problem

Nina Savannah
Ranch Hand

Joined: Oct 15, 2008
Posts: 35
Could someone please please help me with my connection pooling? I have been trying for a while now with no success.
Below is my jsp file that I use for my database connection.
I need someone to help me with the codes that will make this file implement connection pooling.

Your help shall be very much appreciated.

I have edited web.xml and server.xml

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
For starters: do not write Java code in JSP files. Write Java code in Java classes. Doing so in JSP is receipt for trouble.

To use connection pooling, just create a datasource in the application server get a connection from it and handle it the usual way (acquire and close connection/statement/resultset in the shortest possible scope in a try/finally block). How to create a datasource is covered in the documentaiton which came along with the appserver in question. If it is for example Tomcat, you can find here such a document:
Nina Savannah
Ranch Hand

Joined: Oct 15, 2008
Posts: 35
Thank you so much for your response. Here is what I have done
I added the in C:\Tomcat\conf



Now this is far as I can go. I am a beginner and I really dont know much.
The system is due but this part is the only thing holding me back.

If you may please help me with the code that I should add that will allow
the connection pooling. If you could help I would be the happiest person ever.

I am not good with java so if I can work with JSP its best.
Gurjit Sandhu

Joined: Jan 29, 2009
Posts: 11
you have send server.xml and web.xml along with source code. please also tell what problem you are facing means the output error log you are getting with the application.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
As mentioned, following the server's documentation is straight forward. And you do not want to be doing this from your jsp. The jsp is your presentation layer and should not have any code. If you are not good with Java, then you will likely run into trouble if you put all that code in your jsp.

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: Connection Pooling Problem
It's not a secret anymore!