title: Connecting codeigniter to mysql and oracle in the same application
body: <p>I'm using Mysql and Oracle for my CI application. I tried to connect it but I found that I cannot make a query to Oracle database. It always gave an error that the table is not exist.</p>
  
  <p>I already set the database.php to something like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>$active_group = 'oracle';
  $active_record = true;
  
  $db['oracle']['hostname'] = '10.10.10.1:1521/ocidb';
  $db['oracle']['username'] = 'ociuser';
  $db['oracle']['password'] = 'ocipass';
  $db['oracle']['database'] = 'ocidb';
  $db['oracle']['dbdriver'] = 'oci8';
  $db['oracle']['dbprefix'] = '';
  $db['oracle']['pconnect'] = TRUE;
  $db['oracle']['db_debug'] = FALSE;
  $db['oracle']['cache_on'] = FALSE;
  $db['oracle']['cachedir'] = '';
  $db['oracle']['char_set'] = 'utf8';
  $db['oracle']['dbcollat'] = 'utf8_general_ci';
  $db['oracle']['swap_pre'] = '';
  $db['oracle']['autoinit'] = TRUE;
  $db['oracle']['stricton'] = FALSE;
  
  $active_group = 'default';
  $active_record = TRUE;
  
  $db['default']['hostname'] = 'localhost';
  $db['default']['username'] = 'root';
  $db['default']['password'] = '';
  $db['default']['database'] = 'mysqldb';
  $db['default']['dbdriver'] = 'mysql';
  $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;</code></pre>
  </div>
  </div>
  </p>
  
  <p>In a controller, I want to query a table in oracle so I load it there.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>function citizen(){
    $this-&gt;load-&gt;database('oracle',true);
  
    $data['someone'] = $this-&gt;people_model-&gt;getPeople();
    
    $this-&gt;load-&gt;view('myview',$data);
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>And here is the people_model</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>function getPeople(){
    return $this-&gt;db-&gt;get('people')-&gt;result();
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I run it, it will get error</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Error Number: 1146
  
  Table 'mysqldb.people' doesn't exist
  
  SELECT * FROM (`people`) WHERE `id` = '21111'</code></pre>
  </div>
  </div>
  </p>
  
  <p>It seems that it still makes query into the mysql, while the table people is in oracle. I also have tried to load the oracle database in model instead of in controller but same result.</p>
  
  <p>How can I make a query to oracle in this case. Any answer would be appreciated. Thanks.</p>