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-27-2014

[eluser]huangxiao[/eluser]
Hi, dbvend is the name of my database that i created in MSSQLSERVER,okay i will try your post.by the way why is it that the database is "sqlsrv"?


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

[eluser]huangxiao[/eluser]
[quote author="jonez" date="1395929749"]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?
[/quote]


Hi i tried to change to 127.0.0.1,but still same error i could not connect.


Thank you in advance.


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

[eluser]jonez[/eluser]
Sorry I made a mistake above! I set your database to the driver, it should be this:
Code:
$db['default']['hostname'] = '127.0.0.1'; // can also try localhost
$db['default']['username'] = ''; // the user you want to connect as
$db['default']['password'] = ''; // the password for that user
$db['default']['database'] = ''; // the database name that contains your tables
$db['default']['dbdriver'] = 'sqlsrv';



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

[eluser]huangxiao[/eluser]
by the way how do you put username and password to the msssql server database example mine is dbvend how do i put usenrame and password so that i can supply properly to the CI config..


Thank you in advance.


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

[eluser]huangxiao[/eluser]
[quote author="jonez" date="1395934658"]Sorry I made a mistake above! I set your database to the driver, it should be this:
Code:
$db['default']['hostname'] = '127.0.0.1'; // can also try localhost
$db['default']['username'] = ''; // the user you want to connect as
$db['default']['password'] = ''; // the password for that user
$db['default']['database'] = ''; // the database name that contains your tables
$db['default']['dbdriver'] = 'sqlsrv';
[/quote]


By the way is this applicable to all version of Php and apatache in connecting CI to MSSQLServer?


Thank you.


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

[eluser]jonez[/eluser]
Yes that is how you configure a database connection in CI. It should work with any version of PHP, I think 2.1.7 supports up to 5.4 or 5.5? There are some changes in CI3 that work better with 5.6+.