Random successful access with oci and PHP

From: steeve_dun <steeve_dun_at_yahoo.fr>
Date: Tue, 27 Mar 2012 02:39:18 -0700 (PDT)
Message-ID: <15c0a97f-cf1b-49cb-8412-bcf1b62effbd_at_w5g2000vbv.googlegroups.com>



Hi,

I'm trying to access to a remote db with PHP5. in a AIX machine with apache2 and oci
Here's a sample code :

/////////////////////////////////////
define("ADDR",   "IPxxxxxx:1521/db");
define("USER",   "user");

define("PASS", "pwd");
define("BASE", "db");

$db_conn = ocilogon(USER, PASS, ADDR);

$cmdstr = "select * from table";

$parsed = ociparse($db_conn, $cmdstr);

ociexecute($parsed);

$nrows = ocifetchstatement($parsed, $results);
oci_close($db_conn);

for ($i = 0; $i < $nrows; $i++ )
{

        echo $results["1"][$i];
}

/////////////////////////////////

The problem is that sometimes, it shows the results but often, it shows only warnings :

Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in /opt/pware/htdocs/test_OCI.php on line 21

Warning: ociparse() expects parameter 1 to be resource, boolean given in /opt/pware/htdocs/test_OCI.php on line 25

Warning: ociexecute() expects parameter 1 to be resource, null given in /opt/pware/htdocs/test_OCI.php on line 26

Warning: ocifetchstatement() expects parameter 1 to be resource, null given in /opt/pware/htdocs/test_OCI.php on line 28

Warning: oci_close() expects parameter 1 to be resource, boolean given in /opt/pware/htdocs/test_OCI.php on line 29 Received on Tue Mar 27 2012 - 04:39:18 CDT

Original text of this message