473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

read oracle clob with pear::MDB via oci8

hi

i have problems reading an oracle(9i) clob from a php-script with the
MDB-class from pear.

the table files has 3 fields:
id integer
document clob
picture clob

an entry is written to the table with the following code :

require_once('.....pear\MDB.php');
$mdb=&MDB::connect('oci8://user:pw@db');
...
$str_prepStat = 'INSERT INTO files VALUES (1,?,NULL)';
$preparedQuery = $mdb->prepareQuery($str_prepStat);
if(!MDB::isError($preparedQuery))
{
$clobData1 = array(
'Error'=>'',
'Data'=>'some lob data'
);
$clob1 = $mdb->createLob($clobData1);

$mdb->setParamClob($preparedQuery, 1, $clob1, 'document');

if(!MDB::isError($error = $mdb->executeQuery($preparedQuery)))
{
echo 'ok<br>';
$mdb->destroyLob($clob1);
}
else
{
echo $error->getMessage();
}
}

the entry definitly is in the table as i can see when i use sqlplus.

now all i would like to do is to read this content of this line back
into php, i use the following script, taken from the docs that come
with the MDB-bundle (slightly modified/echos inserted):

if(($result=$mdb->query("SELECT document FROM files WHERE id=1")))
{
if($mdb->endOfResult($result))
{
echo "No rows where returned.\n";
}
else
{
echo 'rows <br>';
$clob=$mdb->fetchClob($result,0,"document");
if(!MDB::isError($clob))
{
echo '!MDB::isError($clob) = true, $mdb->endOfLOB($clob) :
'.$mdb->endOfLOB($clob).'<br>';
while(!$mdb->endOfLOB($clob))
{
echo ' t<br>';
if(MDB::isError($error = $mdb->readLob($clob,$data,8000)<0))
{
echo $error->getMessage();
break;
}
else
{
echo 'error in readlob';
}
echo $data;
}
$mdb->destroyLob($clob);
}
else
{
echo '!MDB::isError($clob) = false<br>';
echo 'error in clob<br>';
echo $clob->getMessage();
}
}
$mdb->freeResult($result);
}
else
{
echo $result->getMessage();
}

when executed the message is :error in readlob, which i have no
explanation for?

has anyone had similar problems and/or can help me ?
Jul 17 '05 #1
0 2609

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan | last post by:
Is there any reason to use Pear:db if using odbc? I am thinking that odbc already provides enough abstraction. TIA, Dan
0
by: RDahlstedt | last post by:
I am relatively new to PHP, but with over a decade of experience in C and other programming languages I can usually pick up a new programming language relatively quickly (to be reasonably...
3
by: David | last post by:
Hello all, I have been trying to use the OCI driver to connect to Oracle 9i, but have been getting the following error: java.sql.SQLException: Closed Connection at...
9
by: Keith E. Sauvant | last post by:
Hi, we got a strange problem connecting to an Oracle database onsite with our PHP application: During CSV import job handled by our application, PHP opens up to some hundred connections to the...
3
by: sam.lumbroso | last post by:
I have the following object type created in Oracle (OCI8): create or replace type address as object ( address VARCHAR2(80), city VARCHAR2(80), state VARCHAR2(20), zip VARCHAR2(10) )
11
by: John Nagle | last post by:
I'm looking for something that can read .MDB files, the format Microsoft Access uses, from Python. I need to do this on Linux, without using Microsoft tools. I just need to read the files once,...
0
by: Yannick | last post by:
Hi, I'm Julien from France, We have recently install a new Web Server for my company The server is composed : - Linux RedHat RHEL4 U4 - Httpd-2.0.52-27.ent - Oracle Database 10.2.0.1
2
by: JS | last post by:
Hi. I am writing a c++ program get the data from mdb file using odbc library. By the way, I couldn't get table list from mdb file. i goolgled it up little bit, what i found is only using the...
0
by: =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?= | last post by:
I've been evaluating the possibility of modifying an existing web app with Oracle backend to use the OCI8 functions rather than ODBC. I was attracted by some specific functionalities (specifying...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.