This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

db connection question  RSS feed

 
Chris Montgomery
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working with a team of people on revising a highly used web application.

Connection pooling is currently being used, but the existing approach doesn't properly release the connection back to the pool. To rewrite everything to utilize a pool would be quite painful.

The idea of using only one connection was brought up. No pool, just one connection that you keep up all the time. The idea was that since the application itself is single threaded you would never utilize the benefits of a pool anyway. True?

Having one connection makes me feel somewhat uneasy, but couldn't think of a reason why NOT to do it based on the single threaded concept.

Just looking for advise, ideas, things to watch out for.

Thanks!
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Connection pooling is currently being used, but the existing approach doesn't properly release the connection back to the pool

That is a bug, not a design decision.

I can't think of any situation where a single connection would be preferable to a connection pool (unless the application is a single user app then perhaps).
[ January 07, 2005: Message edited by: Paul Sturrock ]
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37381
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris,
Is your "highly used web application" really single threaded? You can only process one request at a time?

Even if this is currently the case, you don't want to assume it will always be single threaded. Such a design makes scalability very hard.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!