MSSQL Database Configuration using ODBC in CodeIgniter
CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.). The config file is located atapplication/config/database.php. You can also set database connection values for specific environments by placing database.php it the respective environment config folder.
The config settings are stored in a multi-dimensional array with this prototype:
/* Connect MSSQL Server*/
$db['mssql']['hostname'] = 'Driver={SQL Server};Server=192.168.202.20;Database=test_db;
$db['mssql']['username'] = 'sa';
$db['mssql']['password'] = '654321';
$db['mssql']['database'] = 'test_db';
$db['mssql']['dbdriver'] = 'odbc';
$db['mssql']['dbprefix'] = '';
$db['mssql']['pconnect'] = FALSE;
$db['mssql']['db_debug'] = TRUE;
$db['mssql']['cache_on'] = FALSE;
$db['mssql']['cachedir'] = '';
$db['mssql']['char_set'] = 'utf8';
$db['mssql']['dbcollat'] = 'utf8_general_ci';
$db['mssql']['swap_pre'] = '';
$db['mssql']['autoinit'] = TRUE;
$db['mssql']['stricton'] = FALSE;
Thanks a lot. Works Perfectly!
ReplyDeleteThis comment has been removed by the author.
ReplyDeletetnks, it's work!!!!!!
ReplyDeleteWelcome jerez..
DeleteI was having a very hard time getting it to work. This works!!!
ReplyDeleteThanks
Welcome
DeleteI got error :
ReplyDelete"You have specified an invalid database connection group (default) in your config/database.php file."
Can you help me?
Change 'default' for 'mssql'
DeleteGreat job! It works.
ReplyDeleteThank you so so much, It really works.
ReplyDeleteIni sangat bermanfat
ReplyDeletetang cucut