|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74919 DB2 insert LOB data to DB2
Submitted: 2017-07-13 13:56 UTC Modified: 2020-10-11 04:22 UTC
From: frenky dot pv at atlas dot cz Assigned: cmb (profile)
Status: No Feedback Package: PDO ODBC
PHP Version: 5.6.31 OS: Windows 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: frenky dot pv at atlas dot cz
New email:
PHP Version: OS:


 [2017-07-13 13:56 UTC] frenky dot pv at atlas dot cz
From manual page:

I use ODBC driver from IBM Version 11.01.2020.1393

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)
(Re-executing since original execute got SQLCODE = -301)
(Row = 1, iPar = 1, fCType = SQL_C_CHAR, rgbValue = "hello" - x'61686F6A ', pcbValue = 4)
(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:

$db = new PDO('odbc:DRIVER={IBM DB2 ODBC DRIVER - DB2COPY2};;DATABASE=POKUSNA;PROTOCOL=TCPIP;PORT=50000;TXNIsolation=4;Patch2=15;BitData=1', 'db2inst1', 'ibmdb2');

I am test BitData=1 or BitData=0

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);



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-13 13:58 UTC] frenky dot pv at atlas dot cz
BitData = 2 => For BitData = 0
 [2020-10-01 08:59 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-10-01 08:59 UTC]
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] <>
 [2020-10-11 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 05:01:28 2024 UTC