CodeIgniter Forums
I could not connect to MSSQLSERVER 2012 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: I could not connect to MSSQLSERVER 2012 (/showthread.php?tid=60399)

Pages: 1 2


I could not connect to MSSQLSERVER 2012 - El Forum - 03-18-2014

[eluser]huangxiao[/eluser]
Hi, Can i ask some help it's been a whole week for me to configure this code igniter to connect to my MSSQLSERVER 2012...this is my configuration

This is the version of my apatche 2.4.4

version of my php 5.4.16


$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = '127.0.0.1';
$db['default']['username'] = 'sa';
$db['default']['password'] = '';
$db['default']['database'] = 'lgstd';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;


This is the error Call to undefined function sqlsrv_connect() in C:\wamp\www\myapps\system\database\drivers\sqlsrv\sqlsrv_driver.php on line 76

did i miss something ?


Thank you in advance.


I could not connect to MSSQLSERVER 2012 - El Forum - 03-18-2014

[eluser]jonez[/eluser]
The best way to solve problems like that is to Google the error message. The second search result is http://stackoverflow.com/questions/20563146/call-to-undefined-function-sqlsrv-connect and the solution is the first answer.


I could not connect to MSSQLSERVER 2012 - El Forum - 03-18-2014

[eluser]huangxiao[/eluser]
Hi still not working.


I could not connect to MSSQLSERVER 2012 - El Forum - 03-18-2014

[eluser]jonez[/eluser]
Same error or another? If it's the same check phpinfo() and make sure sqlsrv is loaded.


I could not connect to MSSQLSERVER 2012 - El Forum - 03-27-2014

[eluser]huangxiao[/eluser]
Hi, I enabled now i tried the phpinfo(),but here comes another error

Message: require_once(C:/wamp/www/vendor/system/database/drivers/sqlrv/sqlrv_driver.php): failed to open stream: No such file or directory

Filename: database/DB.php

Line Number: 140




Thank you in advance.


I could not connect to MSSQLSERVER 2012 - El Forum - 03-27-2014

[eluser]jonez[/eluser]
Does that file exist at the path listed?


I could not connect to MSSQLSERVER 2012 - El Forum - 03-27-2014

[eluser]huangxiao[/eluser]
yes, by the way here is the config


$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'CARL-PC';
$db['default']['username'] = 'sa';
$db['default']['password'] = '';
$db['default']['database'] = 'dbvend';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

I just put the sa as default.


Thank you in advance






I could not connect to MSSQLSERVER 2012 - El Forum - 03-27-2014

[eluser]jonez[/eluser]
The error you posted is an include error. So either the file doesn't exist at the path listed in the message or it's a file permission issue (less likely).

Can you post a screenshot of your directory structure showing that file with the path to it?


I could not connect to MSSQLSERVER 2012 - El Forum - 03-27-2014

[eluser]huangxiao[/eluser]
Hi, This is the error.

Unable to connect to your database server using the provided settings.

Filename: C:\wamp\www\vendor\system\database\DB_driver.php

Line Number: 124


I could not connect to MSSQLSERVER 2012 - El Forum - 03-27-2014

[eluser]jonez[/eluser]
One of these lines is incorrect:
Code:
$db[‘default’][‘hostname’] = ‘127.0.0.1’; // should be your local address
$db[‘default’][‘username’] = ‘sa’; // confirm username
$db[‘default’][‘password’] = ‘’; // confirm password
$db[‘default’][‘database’] = ‘sqlsrv’; // not sure what dbvend is?