How to use sql server 2012 as my database in codeigniter

advertisements

I want to build an application in Codeigniter and I want to use SQL Server 2012 as my database

I have not tried this yet and I don't know from where should I start.

1- How can I configure my Codeigniter to use SQL Server 2012 database?

2- Can I use Codeigniter Active records to retrive data from SQL Server Databbase?

3- if I can not use Codeigniter How can I use SQL Server Query inside my Codeigniter Models?

Please Give me a detailed Explanation with Example Codes.

thanks.


It can be done from setting of databases in config->database.php add own configuration of database like

//sql cofig setting

$db['rajeev']['hostname'] = 'localhost';
$db['rajeev']['username'] = 'rajeev';
$db['rajeev']['password'] = '[email protected]';
$db['rajeev']['database'] = 'rajeev_ci';
$db['rajeev']['dbdriver'] = 'sqlsrv';
$db['rajeev']['dbprefix'] = '';
$db['rajeev']['pconnect'] = TRUE;
$db['rajeev']['db_debug'] = TRUE;
$db['rajeev']['cache_on'] = FALSE;
$db['rajeev']['cachedir'] = '';
$db['rajeev']['char_set'] = 'utf8';
$db['rajeev']['dbcollat'] = 'utf8_general_ci';
$db['rajeev']['swap_pre'] = '';
$db['rajeev']['autoinit'] = TRUE;
$db['rajeev']['stricton'] = FALSE;

then set $active_group like this

$active_group = 'rajeev';