What I recommend is that you set up another connection in application/config/database.php. So your config might then look something like this:
<?php
return array(
'default-connection' => 'concrete',
'connections' => array(
'concrete' => array(
'driver' => 'c5_pdo_mysql',
'server' => 'localhost',
'database' => 'c5',
'username' => 'uuuuuuuuuuu',
'password' => 'ppppppppppp',
'charset' => 'utf8'
),
'my_new_db' => array(
'driver' => 'c5_pdo_mysql',
'server' => 'localhost',
'database' => 'db_new',
'username' => 'uuuuuuuuuuu',
'password' => 'ppppppppppp',
'charset' => 'utf8'
)
)
);
Then, when you are using your code you can access that connection at any time by doing the following:
//get the default connection
$newDb = \Core::make('database')->connection();
//get the new connection
$newDb = \Core::make('database')->connection('my_new_db');
EDIT: For those looking to change the type of database driver you will need to actually map a driver implementation in your config, which might look something like this:
<?php
return array(
'default-connection' => 'concrete',
'drivers' => array(
'pdo_sqlsrv' => 'Doctrine\DBAL\Driver\SQLSrv\Driver'
),
'connections' => array(
'concrete' => array(
'driver' => 'c5_pdo_mysql',
'server' => 'localhost',
'database' => 'c5',
'username' => 'uuuuuuuuu',
'password' => 'pppppppppp',
'charset' => 'utf8',
),
'my_new_db' => array(
'driver' => 'pdo_sqlsrv',
'server' => 'mydatabaseserver.mycompany.com',
'database' => 'my_new_db',
'username' => 'uuuuuuuuuuu',
'password' => 'ppppppppppp',
)
),
);