1

I have an application which uses oracle.ucp.jdbc.PoolDataSource to maintain pool of JDBC connections. I am able to get a connection and use it.

At the end of my function, I want to return the connection to the pool. I don't find any method to return the the pool.

How to return the connection to the pool?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Chandu
  • 1,837
  • 7
  • 30
  • 51
  • 1
    That should be the usual `connection.close()`. At least that's the standard way to signal to the pool that the client is done using the connection. – ernest_k Oct 31 '21 at 18:57

1 Answers1

3

The fine manual oracle.ucp.jdbc Class PoolDataSourceImpl

This DataSource uses the Universal Connection Pool to get a connection, creating a proxy to that connection, and returning the proxy to the client. When the client calls close on the connection proxy, the underlying physical connection is returned to the pool.

So, as noted in the comments, use connection.close(). The connection is a proxy and the close method will return the connection to the pool instead of closing the connection as is usual.

K.Nicholas
  • 10,956
  • 4
  • 46
  • 66