Answer the question
In order to leave comments, you need to log in
The question is rather theoretical: how to write a failover database connection pool?
I have been given the task of writing a failover database connection pool without using third-party libraries.
As I see the solution: I need to write some kind of manager that will contain two database connections, one main, the other backup. And when requesting a connection to the database from the outside, it will be necessary to check whether the main connection is alive, if yes - then give the connection, if not (an exception is received) - clear the pool of open connections and switch to the backup database with repeating the above actions. And so - that time. Therefore, the question is, is this algorithm sufficient or can it be improved / supplemented?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question