Random Splash

CodeIgniter and Oracle / 2008-10-10

I’ve been writing a lot of code lately and, as a result, my creativity is being sucked up by problem solving. I hope to write something more interesting the next time around.

While trying to figure out how to get CodeIgniter to talk to an Oracle database, I came across this great post which covers in part some of the items I mentioned in my previous Oracle-related post. So I got through it all, followed the instructions, but still couldn’t connect to the database through CodeIgniter — that is, not until I read up on Easy Connect Naming. Here’s what my database configuration settings 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 information you need out of the connection string that usually appears in your tnsnames.ora file (if you’ve got one, that is).

Link / As usual, written by Guillermo A. Fisher.

One Response to “CodeIgniter and Oracle”

  1. Mike Says:

    really helpful … thanks a lot Guillermo

Leave a Reply