Originally posted by Chetan Parekh: Yeah closing in finally block only.
But suppose if I have 10 open connetions, and I close a connection using above mentioned code, then I will have 10-1 = 9 open connections, right?
No. If you are getting connections from a connection pool set up in weblogic using that datasource, when you close the connection it is returned to the pool. It would then be available for the next request that asks for a connection.
You can also configure WebLogic Server to pin a connection to a particular thread. Closing the connection will in such a case cause WebLogic Server to reserve the connection to the thread, so the connection will not be returned to the pool. When the same thread needs a connection again, WebLogic Server will provide the reserved connection. If the thread needs additional connections, then WebLogic Server will create additional connections and pin them to the thread.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop