On CakePHP : How to use and connect alternative database config when it's failed to connect to DB for the first try?

Define your two or more configs in APP/config/database. Php $Database = ConnectionManager::getInstance(); $Database->config = new DATABASE_CONFIG(); $dataSource = $Database->getDataSource('default'); if (!$dataSource->isConnected()) { ... } else { ... } default" is the default connection, just use $Database->getDataSource('yourSecondDataSource') to use another one in the case the first one fails.

Define your two or more configs in APP/config/database. Php $Database = ConnectionManager::getInstance(); $Database->config = new DATABASE_CONFIG(); $dataSource = $Database->getDataSource('default'); if (!$dataSource->isConnected()) { ... } else { ... } "default" is the default connection, just use $Database->getDataSource('yourSecondDataSource') to use another one in the case the first one fails.

Put the that code in database. Php? Are you serious?

– Birkoff Ferguson Nov 1 at 11:48.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions