Code Igniter : Connect to multiple database (MySQL, Oracle) Config

Bajay X Generation -->


$active_group = ;
$active_record = TRUE; //if you want to use active record function set TRUE

//mysql config
$db[]['hostname'] = ;
$db[]['username'] =;
$db[]['password'] =;
$db[]['database'] =;
$db[]['dbdriver'] = 'mysql';

//oracle config
$db[]['hostname'] = ;
$db[]['username'] =;
$db[]['password'] =;
$db[]['dbdriver'] = 'oci8';

In some models, if you call the default database just use :
$this->db->;
Ex: $this->db->get(“users”);

If you want to call the second database (in this case oracle) load the config first.
$this-> = $this->load->database(, true);
Ex :
$this->orclDb = $this->load->database(“orclDb”, true);
$this->orclDb->get(“users”);

may be useful.

Read Users' Comments (0)

Sign up for PayPal and start accepting credit card payments instantly.