Bug #74919 [Opn->Fbk]: DB2 insert LOB data to DB2
Edit report at https://bugs.php.net/bug.php?id=74919&edit=1
ID: 74919
Updated by: cmb@php.net
Reported by: frenky dot pv at atlas dot cz
Summary: DB2 insert LOB data to DB2
-Status: Open
+Status: Feedback
Type: Bug
Package: PDO ODBC
Operating System: Windows 7
PHP Version: 5.6.31
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Do you still get these errors (HY010 and 07006) with any of the
actively supported PHP versions[1]? If so, could you please
provide some more context for the ODBC traces? That would
especially helpful for the BitData = 1 case. The BitData = 0 case
makes some sense on its own, but from looking at the code, I can't
see why there would be an unretrieved error message.
[1] <https://www.php.net/supported-versions.php>
Previous Comments:
------------------------------------------------------------------------
[2017-07-13 13:58:25] frenky dot pv at atlas dot cz
BitData = 2 => For BitData = 0
------------------------------------------------------------------------
[2017-07-13 13:56:02] frenky dot pv at atlas dot cz
Description:
------------
---
From manual page: http://www.php.net/pdo.lobs
---
I use ODBC driver from IBM Version 11.01.2020.1393
Php-5.6.31-nts-Win32-VC11-x86
For BitData = 1
Err ODBC: SQLSTATE [HY010]: Function sequence error: 0
Trace ODBC:
SQLFreeStmt (hStmt = 1: 1, fOption = SQL_DROP)
---> Time elapsed - + 1.730000E-004 seconds
(Unretrieved error message = "[IBM] [CLI Driver] CLI0112E Assignment Error (SQLSTATE =
22005")
(Unretrieved error message = "[IBM] [CLI Driver] CLI0125E Functionality Error (SQLSTATE =
HY010")
For BitData = 2
Err ODBC: SQLSTATE [07006]: Restricted data type attribute violation: -301
Trace ODBC:
SQLParamData (hStmt = 1: 1, prgbValue = & 008fe5b0)
---> Time elapsed - + 1.820000E-004 seconds
(Row = 1, iPar = 1, fCType = SQL_C_CHAR, rgbValue = "hello" - x'61686F6A ',
pcbValue = 4)
(COMMIT REPLY RECEIVED = 1)
(Re-executing since original execute got SQLCODE = -301)
(Row = 1, iPar = 1, fCType = SQL_C_CHAR, rgbValue = "hello" - x'61686F6A ',
pcbValue = 4)
(COMMIT REPLY RECEIVED = 1)
(Unretrieved error message = "[IBM] [CLI Driver] [DB2 / LINUXX8664] SQL0301N The value of the
input variable, expression or parameter number"1" can not be used due to the data type
SQLSTATE = 07006
")
Test script:
---------------
<?php
$db = new PDO('odbc:DRIVER={IBM DB2 ODBC DRIVER -
DB2COPY2};HOSTNAME=db2-test.wps.vsb.cz;DATABASE=POKUSNA;PROTOCOL=TCPIP;PORT=50000;TXNIsolation=4;Patch2=15;BitData=1',
'db2inst1', 'ibmdb2');
/*
I am test BitData=1 or BitData=0
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.apdv.cli.doc/doc/r0008773.html
The images table contains three columns. The first is the autoincrement, the second BLOB and the
third timestamp with the default CURRENT TIMESTAMP.
*/
$stmt = $db->prepare("insert into images (default, imagedata, default) values (?)");
$fp = fopen($_FILES['file']['tmp_name'], 'rb');
$stmt->bindParam(1, $fp, PDO::PARAM_LOB);
$stmt->execute();
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74919&edit=1
Thread (4 messages)