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: 2017-07-13 13:58 UTC
From: frenky dot pv at atlas dot cz Assigned:
Status: Open Package: PDO ODBC
PHP Version: 5.6.31 OS: Windows 7
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC