How to Change Active Databse Connection?
Permalink
If I wanted to switch temporary the active database connection in 5.7 how would I do it? lets say I want to get some data from an external database
I was looking for the Database class, but it doesn't seem to replace the connection already established:
$db = \Database::getFactory()->createConnection(
array(
'host' => 'localhost',
'user' => 'user',
'password' => 'pass',
'database' => 'db'
));
thanks!
I was looking for the Database class, but it doesn't seem to replace the connection already established:
$db = \Database::getFactory()->createConnection(
array(
'host' => 'localhost',
'user' => 'user',
'password' => 'pass',
'database' => 'db'
));
thanks!
Instead, you should be creating a connection on your own and manage it.