Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does keeping Connection open makes our application slow ?

 
Rahul Shivsharan
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • 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 ?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic