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.
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.