• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A single connection enough?

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Gregg!
-- Mike
 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sold!
Thanks All!!!
- Mike
 
reply
    Bookmark Topic Watch Topic
  • New Topic