Search code examples
javasql-serverjdbcc3p0failover

Can C3PO connect to another url if current database unavailable?


We use C3PO in our application. it connected to database_1.

Sometimes this connection can be broken. At this case we should reconnect to another database (database_2)(mirror database). Ideally I want to have a list of reserved databases in configuration.

Does C3PO allow this ?

Maybe sql-server jdbc driver allow something like this ?


Solution

  • C3P0 does not support failover. JTDS jdbc drivers do not support failover to my knowledge. MSSQL drivers support failover https://msdn.microsoft.com/en-us/library/ms378988(v=sql.110).aspx (see failoverPartner in the JDBC url)

    I could give you more information if it was Oracle, you'll need to look at microsoft documentation on failover to see if it fits your needs.