Oracle PDO UTF-8 problem

[email protected] (Karsten Lehmann) Thu, 13 Jan 2011 09:33:35 +0100
Newsgroups php.pdo
Message-ID <[email protected]>
Hello

I try to read a 2000 character long string out of database. The database 
is an oracle 10g Express Edition with UTF-8 character set. To read the 
string we use the PDO abstraction layer with oci-driver. If the 2000 
character contains one or more UTF-8 characters we get the problem that 
PDO truncate the result of the database, with the following message:

Warning: PDOStatement::fetchAll() [pdostatement.fetchall]: column 5 data 
was too large for buffer and was truncated to fit it in 
C:\wamp\www\wp\bp.php on line 115


The definition of the database column is

TESTSTRING VARCHAR2(2000 CHAR)

CHAR means that we can store up to 2000 characters independent from the 
encoding of the character (e.g. UTF8).


I also init the PDO with UTF8

$dbh = new PDO('oci:dbname=' . $db_name . ';charset=UTF8', $db_user, 
$db_pw);


If i read the same string with java and JDBC-driver it works fine, so i 
can exclude a database error.

How i have to configre PHP/PDO to be aware of the truncation of the 
result string?