• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Connection Pooling Problem

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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



 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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: http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
 
Nina Savannah
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much for your response. Here is what I have done
I added the in C:\Tomcat\conf

web.xml





server.xml





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.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic