• 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

Does keeping Connection open makes our application slow ?

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is my code



the above code snippet is a part of an enterprise application, which uses ejb 2 .0 . This application uses OC4J as app server.

And This application is being used by about 2000 people a day on minute by minute basis.

Now lets see the above code , here the connection and preparedstatement and result are not closed in finally block.

and i get connection from a class DBHelper which does a look up through JNDI and fetches the Connection.

So my question is , if this above code which does not closes the connection is being called like 5 time a second in a day from 9.30 am to 5.30 am

will this above mistake will slowdown my application in the further course of the day .

OR

Does piling of such unclosed database connection can make my application slow ?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


will this above mistake will slowdown my application in the further course of the day .

OR

Does piling of such unclosed database connection can make my application slow ?


Not on its own. The connections will keep hold of resources that can't be garbage collected and will keep hold of database resources, so you will run out of available database connections. I'd expect to se a steady increase in memory used, which may or may not slow it down, then exceptions once there are no available connections left.
 
reply
    Bookmark Topic Watch Topic
  • New Topic