guillermo, out of repose

CodeIgniter and Oracle

I’ve been writ­ing a lot of code lately and, as a result, my cre­ativ­ity is being sucked up by prob­lem solv­ing. I hope to write some­thing more inter­est­ing the next time around.

While try­ing to fig­ure out how to get CodeIgniter to talk to an Ora­cle data­base, I came across this great post which cov­ers in part some of the items I men­tioned in my pre­vi­ous Oracle-related post. So I got through it all, fol­lowed the instruc­tions, but still couldn’t con­nect to the data­base through CodeIgniter — that is, not until I read up on Easy Con­nect Nam­ing. Here’s what my data­base con­fig­u­ra­tion set­tings look like:

$db['default']['hostname'] = "HOST/SERVICE_NAME";
$db['default']['username'] = "USERNAME";
$db['default']['password'] = "PASSWORD";
$db['default']['database'] = "";
$db['default']['dbdriver'] = "oci8";
$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";

You can pull all of the infor­ma­tion you need out of the con­nec­tion string that usu­ally appears in your tnsnames.ora file (if you’ve got one, that is).