My app currently connects to default/primary database defined in the yaml file. This works great. The challenge I'm having is determining or checking if this database is is down, so that I can create manual DatabaseConfig object and and connect to the secondary database. Seems simple enough, think I'm doing something wrong.
However if the database offline it doesn't seem to throw exceptions I can catch. The try-catch clauses are not cathing the DataSourceInitialiseException, Exception at all
Log:
10:28:30.460 [main] ERROR i.e.datasource.pool.ConnectionPool - FATAL: DataSourcePool [db] is down or has network error!!! 10:28:30.473 [main] ERROR io.ebean.Ebean - Error trying to create the default Database io.ebean.datasource.DataSourceInitialiseException: Error initialising DataSource: IO Error: The Network Adapter could not establish the connection at..