No, you cannot reopen a closed connection. It's a dead object for the most part and one that represents a physically dead connection.
Data sources create a new connection on getConnection(), as described in the API. Database pools on the other hand maintain a set of connections and open/close them as needed. If the number of available connections is below the pool minimum, a new one is opened.
The key thing to note is that once you open a connection with a DataSource, it is your responsibility to make sure it gets closed, which is why you should always use a finally block for closing JDBC resources.
Database pooling is complex and is generally vendor-specific. That said, most have a minimum and maximum number of connections and will auto-create connections if the number available falls below the minimum.
Joined: Jul 16, 2010
will auto-create connections if the number available falls below the minimum
If that is the case what advantage do i get from connection pooling Scott, i could create connection object when ever it is required in my code? What is the advantage of having predefined number of connections in the connection pooling?