This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
If you close your connection using conn.close() it will be returned to the pool, but the actual connection will not necessarily be released. However, when you get a new connection from the pool this previous connection might be used again, eliminating the overhead of actually creating a new connection.
You can specify the preferred and maximum number of active connections, as well as the timeout for the connections (i.e. the time it takes before they are actually released by the server if unused) in the pool using the administration console.
Releasing the connection is not our hand. It depends on the container. But when you do Connection.close(), then connection is aviable to Container to recollect it and give it to another resource if required.