#18750 [Com]: OCI8 failure: CHAR/VARCHAR2 datatypes in query causing errors
| From: | robert at ud dot com | Date: | Tue, 06 Aug 2002 15:31:29 +0000 |
| Subject: | #18750 [Com]: OCI8 failure: CHAR/VARCHAR2 datatypes in query causing errors | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-16073@lists.php.net to get a copy of this message | ||
ID: 18750
Comment by: robert@ud.com
Reported By: robert@ud.com
Status: Closed
Bug Type: OCI8 related
Operating System: RH Linux 7.2
PHP Version: 4.2.1
New Comment:
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).
Previous Comments:
------------------------------------------------------------------------
[2002-08-06 05:24:00] 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-05 20:41:42] robert@ud.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);
-------------------------
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18750&edit=1