Welcome Guest, Not a member yet? Register   Sign In
Problem with Codeigniter and Oracle
#1

[eluser]Unknown[/eluser]
Hi,

I've been doing a simple connect then get some data in my local Oracle database.
Here's the basic thing i've done:

- in php.ini - incommented the oci8 extension
- including this one: oci8.privileged_connect = On
- hope this is sufficient

- Here's my connection string:

$db['dcv2']['hostname'] = "(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)))(CONNECT_DATA =(SID = XE)))";
$db['dcv2']['username'] = "HR";
$db['dcv2']['password'] = "testing";
$db['dcv2']['database'] = "";
$db['dcv2']['dbdriver'] = "oci8";
$db['dcv2']['dbprefix'] = "";
$db['dcv2']['pconnect'] = TRUE;
$db['dcv2']['db_debug'] = false;
$db['dcv2']['cache_on'] = FALSE;
$db['dcv2']['cachedir'] = "";
$db['dcv2']['char_set'] = "utf8";
$db['dcv2']['dbcollat'] = "utf8_general_ci";
==========
When turning db_debug True or False, i get separate error messages:

When true:
A Database Error Occurred
Error Number:

SELECT COUNT(SYSDATE) FROM DUAL;
==========
When false:
Fatal error: Call to a member function num_rows() on a non-object in C:\xampp\htdocs\CPM\system\application\models\DbSyncModel.php on line 16

==========

As seen it's just a simple query to check my connection. Here's the code:

$dcv2DB = $this->load->database('dcv2', TRUE);

$sqlSource = 'SELECT COUNT(SYSDATE) FROM DUAL;';
$result = $dcv2DB->query($sqlSource);
echo $result->num_rows();
$dcv2DB.close();

I just want to check and see if it will indeed print our '1'.

But i am not able to do so.

Guys, looking for some assistance here and possible tutorials for Oracle and Codeigniter.

Thanks!
#2

[eluser]regal2157[/eluser]
I know with the site I manage with Oracle, we only set this info up for each db in the config:

$db['name']['hostname'] = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=sid)))';

do you need your ADDRESS_LIST= part?




Theme © iAndrew 2016 - Forum software by © MyBB