Welcome Guest, Not a member yet? Register   Sign In
SQL SERVER connection.
#1

[eluser]josepichu[/eluser]
Hi !

In my project I work with a MySQL database, but I need in some cases connect to a mssql database to make some queries, and i don't know how can i do it.

I tried to define the mssql configuration in the database.php config file:

Code:
$active_group = 'mssql';

$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '*****';
$db['default']['dbdriver'] = 'mysql';

....


$db['mssql']['hostname'] = 'localhost';
$db['mssql']['username'] = 'root';
$db['mssql']['password'] = '******';
$db['default']['dbdriver'] = 'mssql';

...

But i can't to update the $active_group var to choose the mssql configuration in ejecution time.

¿How do you could do it?

Thanks!
#2

[eluser]PhilTem[/eluser]
Please refer to the user's guide section Database - Connecting paragraph "Connecting to Multiple Databases" or here if you don't mind reading the nightly user's guide (and want to avoid scrolling Wink )




Theme © iAndrew 2016 - Forum software by © MyBB