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!

6glcorp
 
goutnet replied on at Permalink Reply
Well, I would not recommend to *change* the current connection, since pretty much everything relies on the connection.

Instead, you should be creating a connection on your own and manage it.