Search code examples
javac3p0

What is the impact of updating C3PO JDBC url?


I have a datasource which is a wrapper aroung a C3PO connection pool. It uses the following failover policy:

  1. Get connection from C3PO
  2. If it fails, then update the existing C3PO JDBC url to point to another server

What will happen with my existing open connections?


Solution

  • Any Connections via the old JDBC URL help by the pool and not checked out will be closed when you update the URL.

    Connections via the old URL that are in use by clients will not be interfered with, but when clients call close(), those Connections will be destroyed rather than being checked back into the pool. Only Connections via the new URL will be maintained in the pool.