Results 1 to 2 of 2
  1. #1
    ersachinjain is offline Member
    Join Date
    Aug 2009
    Posts
    51
    Rep Power
    0

    Default Close connection object

    Hi

    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.

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    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.

Similar Threads

  1. Replies: 13
    Last Post: 04-09-2010, 11:15 AM
  2. close to zero
    By nokicky in forum New To Java
    Replies: 6
    Last Post: 10-26-2009, 04:30 PM
  3. Replies: 7
    Last Post: 10-20-2009, 10:34 AM
  4. Getting warnings reported by Connection object
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-20-2008, 08:57 AM
  5. How to close JDBC Connection
    By Heather in forum JDBC
    Replies: 2
    Last Post: 07-15-2007, 01:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •