Results 1 to 2 of 2
Thread: Close connection object
- 05-28-2010, 04:48 PM #1Member
- Join Date
- Aug 2009
- Rep Power
Close connection object
I have made a client/server application. After say x number of socket connections the sever is not sending the object across the network to the client. Initilay I thought its a socket or stream problem but now I have the feeling that it could be something related with database connection object. There is proper socket connection every time, but I am not closing the connection object. Could this be the reason that the object is not getting transferred to the client side. any help is appreciated.
- 05-30-2010, 12:30 AM #2
yes, if you are not using a jdbc connection pool, such as you create a new database connection every time and when finished the database connection handle is just being discarded, not closing the objects would cause the connection to be closed when ever the JVM gets around to doing its garbage collection, which in a server environment with frequent requests could cause this situation where the application is not able to connect due to connection exausted.
if you are using a jdbc connection pool, it is customary to always close() the jdbc connection when you are finished with it. Because the connection pools typically wrap the connection object to override the close() method to mean to have the connection returned to the pool, it doesn't actually close it in this case. So here it is certainly very important to close() the jdbc connections when you are finished with them, so that they may be returned to the pool.
- By Stephen Douglas in forum New To JavaReplies: 13Last Post: 04-09-2010, 11:15 AM
- By nokicky in forum New To JavaReplies: 6Last Post: 10-26-2009, 05:30 PM
- By zengqingyi12 in forum JDBCReplies: 7Last Post: 10-20-2009, 10:34 AM
- By Java Tip in forum Java TipReplies: 0Last Post: 01-20-2008, 09:57 AM
- By Heather in forum JDBCReplies: 2Last Post: 07-15-2007, 01:07 PM