Hi Christopher,

Christopher Tava wrote:

dear ojb user group,
could you kindly tell me the properly way to look a connection from the connection pool?
i have used the following call, but i get a socked closed exception.


Connection conn =

pBroker.serviceConnectionManager().getConnection();

2004-01-27 10:45:46,609 [RMI TCP Connection(126)-162.86.116.94] ERROR [com.server.TBean] java.sql.SQLException: Io exception: Socket closed


That's the right way to handle connections within OJB. This method returns a connection from the ConnectionFactory (e.g. connection-pool impl).


pBroker.serviceConnectionManager().releaseConnection();

cleanup used connection (Never do a con.close() call!!)

If you lookup the connection within a tx, it's not allowed to do connection cleanup.

If you don't do any connection cleanup, at the latest connection was released on PB.close() call.

So your problem occur, because you close used connections or the connection is get timed out.
To avoid last, if your DB support reconnect of timed out connection enable it or use a 'validationQuery' in jdbc-connection-descriptor to do a real connection check before Connection was returned from pool.


regards,
Armin



your assistance is much appreciated,

chris






--------------------------------- Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to