php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
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();
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-10-01 08:59 UTC] cmb@php.net
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>
 [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 Apr 25 10:01:29 2024 UTC