aspose file tools*
The moose likes JDBC and the fly likes Does keeping Connection open makes our application slow ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Does keeping Connection open makes our application slow ? " Watch "Does keeping Connection open makes our application slow ? " New topic
Author

Does keeping Connection open makes our application slow ?

Rahul Shivsharan
Ranch Hand

Joined: Jun 17, 2009
Posts: 83
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

Joined: Apr 14, 2004
Posts: 10336


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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does keeping Connection open makes our application slow ?