This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
it's always better to close connections immediately if you know you don't need them anymore. I can imagine that it depends on the JDBC implementation if connections are closed correctly when you shutdown an application. If they're not closed correctly they may still appear as opened on the server side and so eating up resources and locking out other database clients waiting for free connections!
The JVM does completely nothing with the connection. You've it in your own hands. Always acquire and close them in the shortest possible scope. To improve performance, just introduce connection pooiling. This does still not mean that you change the way of opening/closing connections in your JDBC code.
RaviNada Kiran wrote:The Server can manage this things automatically .For example Timeout (Minutes) in BEA WebLogic
It's called 'connection pooling'. That's not something magical. You still have to write your JDBC code so that you close connections and other resources the right way. Otherwise it will still run out of connections sooner or later.