Welcome Guest, Not a member yet? Register   Sign In
Connecting to Oracle Database
#1

[eluser]imorris[/eluser]
I need some assistance getting connected to an Oracle database. I have the Oracle 10g client installed on my machine and have been able to connect to the database in other projects (like VB Scripting). I get an error when the page loads that looks like this:

Code:
A PHP Error was encountered

Severity: Notice

Message: Use of undefined constant OCI_COMMIT_ON_SUCCESS - assumed 'OCI_COMMIT_ON_SUCCESS'

Filename: database/DB.php

Line Number: 133

Here is my dbconfig.

Code:
$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "server:port/instance";
$db['default']['username'] = "username";
$db['default']['password'] = "password";
$db['default']['database'] = ""; //Do I need to specify a database name here?
$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";
#2

[eluser]imorris[/eluser]
I figured out that I need to uncomment "OCI8" in php.ini. And now I'm getting a different error:

Code:
A Database Error Occurred

Unable to connect to your database server using the provided settings.
#3

[eluser]imorris[/eluser]
I fixed it.

I had to restart Apache after uncommenting php.ini.
I verified that my tnsnames.ora was correct.
I also changed my dbconfig to look like this:

Code:
$db['default']['hostname'] = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<IPADDRESS>)(PORT=<PORT_NUMBER>))(CONNECT_DATA=(SERVICE_NAME = <INSTANCE>)))";
$db['default']['username'] = "<username>";
$db['default']['password'] = "<password>";
$db['default']['database'] = "<database name>"; //I'm still not sure if this is required!??
$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";
#4

[eluser]imorris[/eluser]
Ok, ran into last issue. How do I specify the name of the database? My queries are erroring out and I think it's because the database name isn't specified anywhere. The Wiki says that 'database' is ignored when using oci8.
#5

[eluser]imorris[/eluser]
Nevermind. All is well now. Turns out (from reading this post: http://ellislab.com/forums/viewthread/161482/) that the query becomes case sensitive through Active Records. I adjusted my case and everything's better.




Theme © iAndrew 2016 - Forum software by © MyBB