|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-03-15 12:52 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2021-03-15 12:52 UTC] cmb@php.net
[2021-03-15 13:56 UTC] rick dot meertens at gmail dot com
[2021-03-15 14:19 UTC] cmb@php.net
-Status: Feedback
+Status: Open
[2021-03-15 14:19 UTC] cmb@php.net
[2021-03-16 10:50 UTC] cmb@php.net
-Assigned To: cmb
+Assigned To:
[2021-03-18 13:35 UTC] cmb@php.net
[2022-12-27 09:06 UTC] farid dot jamili4118 at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
Description: ------------ While reading a BLOB(1MB) field from an AS400 DB2 database with the PDO ODBC - IBM i Access ODBC driver we are missing 7 hex chars every 255th position in the stream. I am using PHP 7.3.27 with the underlying IBMiAccess_v1r1_WindowsAP_English v1.1.8.6 ODBC driver. -Install the IBM iAccess ODBC driver. -Enable PHP extension pdo_odbc. -Create a column with type blob and length 1048576; -Fill a blob field with: for($i = 0; $i<50; $i++) { $blobData=$blobData."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; } -Read it with script below. Test script: --------------- //credentials $db_host = ''; $db_user = ''; $db_pass = ''; $table = ''; $blob_field = ''; $id_field = ''; $id = ''; $connection = new PDO("odbc:Driver={iSeries Access ODBC Driver};System=$db_host;UID=$db_user;PWD=$db_pass;"); $sql = "SELECT $blob_field FROM $table WHERE $id_field = ?"; $stmt = $connection->prepare($sql); if(!$stmt) {throw new Exception("Error while executing prepare: $sql [".$connection->errorInfo()."]");} if(!$stmt->execute(array($id))) { throw new Exception("Error while executing query() execute: $sql [".$connection->errorInfo()."]");} $stmt->bindColumn(1, $lob, PDO::PARAM_LOB); $stmt->fetch(PDO::FETCH_BOUND); echo $lob; //hexToAscii($lob) Expected result: ---------------- 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A666C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 61626364 etcetera Actual result: -------------- 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636 68696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A66 F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 6162636465666768696A6B6C6D6E6F70717 767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839 61626364 etcetera