• 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

Connection Pooling Problem

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Our application runs under WebLogic and Oracle.

The problem we ran into was creating "Manager" classes from a Struts action class (a Singleton). The actual problem was that our connection count kept increasing even though we closed the connections. We could see the connection
count climbing (in the Weblogic monitor) with each DAO access.

It seems that after the first action class did its thing with the database and then the next action class created some classes (DAOs), connections weren't being closed property. The code explicitly calls close on the connection, the result set and the statement.

Once we moved the instantiation of the manager classes to an EJB (and out of an action class), the problem went away. No more connection pooling issues.

Is an action class, therefore, a bad place to create objects which have connections the database via, say, connection pooling?

Thanks in advance for any comments.

Mike
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your view should never directly create or access a database connection.
 
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
Hi Chris,

I guess my posting wasn't clear.

We're creating database connections in a J2EE application the correct way with DAO and related classes. We're also using connection pooling.

Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic