Connect sqlsrv in Xampp Connect sqlsrv in Xampp codeigniter codeigniter

Connect sqlsrv in Xampp


EDIT-First you need to download the driverhttp://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx

Now go to your XAMPP installation and search for php.dllIt will display correct PHP dll you have.

1) move following files to xampp/php/ext directory.

php_sqlsrv_53_nts_vc9.dllphp_pdo_sqlsrv_53_nts_vc9.dll

2) If you have php5ts.dll then move following files to xampp/php/ext directory.

php_sqlsrv_53_ts_vc9.dllphp_pdo_sqlsrv_53_ts_vc9.dll

above files should be used if your PHP version is compiled with Visual C++ 9.0 . Else following files should be used.

1) If you have php.dll then move following files to xampp/php/ext directory.

php_sqlsrv_53_nts_vc6.dllphp_pdo_sqlsrv_53_nts_vc6.dll

2) If you have php5ts.dll then move following files to xampp/php/ext directory.

php_sqlsrv_53_ts_vc6.dllphp_pdo_sqlsrv_53_ts_vc6.dll

Now we have to load files that we added recently. Open the php ini file and add entry in the area of dynamic extensions as follow.

extension=php_sqlsrv_53_nts_vc9.dllextension= php_pdo_sqlsrv_53_nts_vc9 .dll 

Save the ini files and restart XAMPP


$check= @$CI->load->database($config, TRUE); // ommit the errorif ($check->call_function('error') !== 0) {    // Failed to connect}

I don't know for sure what you are trying to do but in codeigniter you don't need to initialise database, CI automatically does it for you

so-

$this->load->database();$db_obj = $this->db->load('SQL_Test',TRUE);$connected = $db_obj->initialize();

this is not needed.

You just need to load the model and in model start performing queries.$this->load->database();In controller you need to load the model like-

$this->load->model('my_model');

then call the model function in which you have written the queries.

$this->my_model->myfunction(); 


Your XAMPP setup doesn't have sqlsrv support.You need to enable it in php.ini.

extension=php_sqlsrv.dllextension=php_pdo_sqlsrv.dll