• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A single connection enough?

 
Mike London
Ranch Hand
Posts: 1216
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a small system (< 50 users), is a single Connection, created in the init() of a servlet, for example, enough to then pass around a Statement object for various methods (users) to use?
Thanks in advance.
-- Mike
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a web app, I always suggest using a Connection Pool and allowing enough connections for an estimated each user (to an extent).
1. A Connection Pool is easy to setup in any Web App.
2. That < 50 Web App can quickly jump to a > 50 web app, then you already have a Connection Pool in place and you aren't struggling to implement one and change it in all your code
3. Anything > 1 person, a Connection Pool should perform better.
There are other reasons that I can't think of and hopefully someone else can jump in and fill the gap.
 
Mike London
Ranch Hand
Posts: 1216
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Gregg!
-- Mike
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I second everything that Gregg said. In the "old" days everybody was trying to "roll their own" connection pools and some worked well and others didn't work very well. However now all you have to do is download the appropriate JAR files [I use the Apache commons pooler/DBCP], do a little configuration, and you're on your way.
Since there is almost no extra work involved and it's so flexible and extensible, use a pool.
 
Mike London
Ranch Hand
Posts: 1216
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sold!
Thanks All!!!
- Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic