How to test the custom database connection? |
Hello guys,
I am allowing remote DB connection to my app as a custom connection, I want to test and control the error handling on my view template. if the connection fails or not. try { $forge = \Config\Database::forge($custom); $forge->createDatabase('my_db_3'); } catch(\Exception $e) { echo "Conenction Error"; } But it throws CI debug error page CodeIgniter\Database\Exceptions\DatabaseException #8 Unable to connect to the database. Main connection [MySQLi]: Access denied for user '****'@localhost (using password: YES) How handle the test case? |
Welcome Guest, Not a member yet? Register Sign In |