Connect Codeigniter with MySql and Oracle
Thursday, December 29, 2016
MySql Connection Settings:
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost'; //your host
$db['default']['username'] = 'username'; //your database username
$db['default']['password'] = 'password'; //your database password
$db['default']['database'] = 'database_name'; //your database name
$db['default']['dbdriver'] = 'mysql'; //your database type
Oracle Connection Settings:
$active_group = 'default';
$active_record = TRUE;
$tnsname = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL)))';
$db['default']['hostname'] = $tnsname ; //your tns connection
$db['default']['username'] = 'username'; //your schema username
$db['default']['password'] = 'password'; //your schema password
$db['default']['database'] = '';
$db['default']['dbdriver'] = 'oci8'; //your database type
Enable extensions for oci8 (Oracle) in php.ini
Open php.ini file and remove ; before the line of extensions as bellows
before:
;extension=php_oci8.dll
;extension=php_oci8_11g.dll
after:
extension=php_oci8.dll
extension=php_oci8_11g.dll
Labels: Codeigniter, MySql, Oracle
Post a Comment