php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18750 OCI8 failure: CHAR/VARCHAR2 datatypes in query causing errors
Submitted: 2002-08-05 20:41 UTC Modified: 2002-08-06 05:24 UTC
From: robert at ud dot com Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.2.1 OS: RH Linux 7.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: robert at ud dot com
New email:
PHP Version: OS:

 

 [2002-08-05 20:41 UTC] robert at ud dot com
PHP 4.2.1 compiled using --with-oci8 against Oracle 9i (9.2) libs on RH Linux 7.2 querying an Oracle 9i database.
Running any query that contains any Oracle CHAR or VARCHAR2 datatype returns the following error: "Warning: OCIStmtExecute: ORA-03115: unsupported network datatype or representation"

- Running the same queries in Oracle sqlplus client on Linux machine where PHP was built returns all data correctly.

- Running queries that only contain numbers or dates work perfectly fine all the way from Oracle to PHP output.

- Weirdly, casting the CHAR datatypes inside the query by wrapping them with TO_CLOB(foo) allows PHP to display data correctly.

Are the OCI8 functions not completely compatible with the latest Oracle 9i (9.2) release and client libs?

The PHP code I running to simply test Oracle connectivity and basic querying:
------------------------
putenv("ORACLE_HOME=/opt/oracle/product/9.2.0");

//fails:
$strSQL = "SELECT ENAME, EMPNO FROM SCOTT.emp";

//works: 
//$strSQL = "SELECT EMPNO FROM SCOTT.emp";

//works: 
//$strSQL = "SELECT TO_CLOB(ENAME), EMPNO FROM SCOTT.emp";

$objDBCN = OCILogon("foo_uid","foo_pwd","foo_SID");
$objSTH = OCIParse($objDBCN, $strSQL);
OCIExecute($objSTH);
OCIFetchStatement($objSTH, $objRS);
echo "<pre>";
print_r($objRS);
echo "</pre>";
OCIFreeStatement($objSTH);
OCILogOff($objDBCN);
-------------------------

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-06 05:24 UTC] thies@php.net
do NOT use putenv (or setenv in httpd.conf) to set the  
oracle environment variables. it does _NOT_ work. please  
set ORACLE_HOME, _SID and NLS_KANG in /etc/init.d/httpd  
(or whatever you apache start-script is called).  
  
 [2002-08-06 11:31 UTC] robert at ud dot com
Made change as suggested.
Errors resolved.  Please mark bug as "bogus".
(but maybe it is not truly "bogus" as the PHP documentation shows examples using putenv).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC