connections pool

Discussions

EJB design: connections pool

  1. connections pool (5 messages)

    Hello
    when i use datasource to obtain a connection from the server connections pool, i close it after i have finished my work. I do like that because i have red that in books. But how can a connection be shared between users if one the users can close the connection. When client close the connection, the server has to open it again and it affects performance negatively. I believed that the server could shared active connection between clients. But how is it possible if one can close it ?
    So what is exactly sharing connection ? is it a solution to be sure that from a server there will never be more than X connections on a sgbd in the same time ? or is it more
    Thank you very mutch

    Threaded Messages (5)

  2. RE: connections pool[ Go to top ]

    Olivier,
    When you call connection.close() the connection is not actually closed. The container ends up getting this call which basically indicates to it that you are no longer interested in using this connection and that its ok for the server to return it to the pool. So connection.open == getfromPool, and connection.close == returntoPool as far as the container is concerned.

    Cheers,
    AT
  3. connections pool[ Go to top ]

    thank you very much
    So connections can't be shared in the same time by two or more client. is it true ?
    And about the resources. When a client make a close(), does the server release the resources (resultset, statement ...) associated with this connection before this connection can be used by an other client ?
  4. connections pool[ Go to top ]

    ps: are the connections in the pool always active on the sgbd ? or can the connection be really closed by the server and re-open when a client ask a connection ?
    thank you
  5. connections pool[ Go to top ]

    Connection at the same time cannot be shared by two people. What connection sharing here means, the same connection is given to another user later time, after the first user closes the connection( Closing the connection is returning it back to the app server). Thanks

    Sridhar Ramshetti
  6. Read the JDBC 3.0 specification[ Go to top ]

    JDBC 3.0 specification:

    {{
    When an application is finished using a connection, it closes the logical connection using the method Connection.close. This closes the logical connection but does not close the physical connection. Instead, the physical connection is returned to the pool so that it can be reused.
    Connection pooling is completely transparent to the client: A client obtains a pooled connection and uses it just the same way it obtains and uses a nonpooled
    connection.
    }}

    http://java.sun.com/products/jdbc/