Bug #74919 [NEW]: DB2 insert LOB data to DB2

From: Date: Thu, 13 Jul 2017 13:56:08 +0000
Subject: Bug #74919 [NEW]: DB2 insert LOB data to DB2
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210043@lists.php.net to get a copy of this message
From:             frenky dot pv at atlas dot cz
Operating system: Windows 7
PHP version:      5.6.31
Package:          PDO ODBC
Bug Type:         Bug
Bug description:DB2 insert LOB data to DB2

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 bug report at https://bugs.php.net/bug.php?id=74919&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=74919&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=74919&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=74919&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=74919&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=74919&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=74919&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=74919&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=74919&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=74919&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=74919&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=74919&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=74919&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=74919&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74919&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=74919&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=74919&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=74919&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74919&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=74919&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=74919&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#210043) next »