• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connection pooling/threading

 
Aodhan Hoffman
Ranch Hand
Posts: 35
Java MyEclipse IDE Redhat
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a difference between setting up a db connection through tomcat (using the tomcat config ) and building one internally into a servlet? I'm looking to improve the performance of my project and am uncertain which path to take. Also, does the tomcat configuration affect how threading within servlets are handled? ( If so, does Pro Jakarta Tomcat 5 cover these issues? ) Thanks!
 
David Ulicny
Ranch Hand
Posts: 724
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setup db connection through app server will create a pool of that connections. In servlet you must do this manualy.

Which performance you mean? Is your application slow or consumes much resources?
 
Aodhan Hoffman
Ranch Hand
Posts: 35
Java MyEclipse IDE Redhat
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for my application, for each request it handles, it must make several sql queries. Sometimes multiple JDBC connection objects are created in the cycle of the request. I'm thinking of threading the sql queries to improve speed.

Regarding threading, what I want to know is whether how the container is set up, the Tomcat configuration, might impact the threading of my application.
 
Lee Barney
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The biggest issue I see with using the containers connection pooling is with portablility.

The code to create a good connection pool is fairly trivial and small. This being the case, why would I want to reduce my flexabiltiy when I could readily handle such things as the threading you mentioned as a requirement in my own code?

I know that if there were many lines of code required to create a timed self leveling pool that it would be adventageouse to use the container to do this. It is not the case that a large amount of code is required to do this so I have chosen to create my own.
 
Surasak Leenapongpanit
Ranch Hand
Posts: 341
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Commons DBCP and Commons DbUtils.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic