php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57318 Unable to insert Blob data
Submitted: 2006-10-23 04:40 UTC Modified: 2006-10-23 10:24 UTC
From: sherman dot chan at world dot net Assigned:
Status: Not a bug Package: ibm_db2 (PECL)
PHP Version: 5.0.2 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
14 + 2 = ?
Subscribe to this entry?

 
 [2006-10-23 04:40 UTC] sherman dot chan at world dot net
Description:
------------
I tried to insert a blob data to my IBM DB2 database, verions 8.1, though PHP with ibm_db2-1.5.1, the script ran ok, it did not give me any error, but I found no data was inserted.

db schema

create table test_blob (
       tcode                 character(10),
       tblob                 blob
);


BTW, I db2_exec() to create a table with the schema on above witout any problem, I can see the table with db2 cli

I just wonder did I missed anything, I have have tried pass an array to db2_execute () instead of using db2_bind_param(), but still no luck.

Thanks
Sherman


Reproduce code:
---------------
<?
$db2host ="xxx.xxx.xxx.xxx";$db2uid = "db2inst1";
$db2pwd = "db2inst1";$db2port = "50004";
$connStr = "DRIVER={IBM DB2 ODBCDRIVER};DATABASE=TEST;".
"HOSTNAME=$db2host;PORT=$db2port;".                            "PROTOCOL=TCPIP;UID=$db2uid;PWD=$db2pwd;";     
$conn = db2_connect ($connStr, '', '');
$sql = "insert into  test_blob (tcode, tblob) values (?, ?) ";
$stml = db2_prepare ($conn, $sql);
db2_bind_param ($stml, 1, "tcode", DB2_CHAR, DB2_PARAM_IN);
db2_bind_param ($stml, 2, "tblob", DB2_BINARY,DB2_PARAM_IN);
db2_execute ($stml);
db2_commit ($conn);
$sql = "select count(*) from  twn_php_object";
$stml = db2_exec ($conn, $sql);
while ($res = db2_fetch_array($stml)) {
   var_dump ($res);
}
?>

Expected result:
----------------
I expect the result
array(1) {
  [0]=>
  int(1)
}


Actual result:
--------------
array(1) {
  [0]=>
  int(0)
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-23 10:24 UTC] kfbombar at us dot ibm dot com
Hi Sherman,

I am a bit confused on what you are trying to do in your PHP script.  I see a few issues with your script.  I am able to insert a BLOB with no issues.  Please look over the script below, and if you have any other questions, feel free to email me.  Thanks,

--Kellen (kfbombar)

<?php

$conn = db2_connect('sample', 'db2inst1', '*******');

db2_exec($conn, "create table test_blob (tcode character(10), tblob blob)");
$sql = "insert into  test_blob (tcode, tblob) values (?, ?) ";
$stml = db2_prepare ($conn, $sql);
$tcode = "1";
$tblob = dirname(__FILE__) . "/some_binary_file.jpg";
db2_bind_param ($stml, 1, "tcode", DB2_CHAR, DB2_PARAM_IN);
db2_bind_param ($stml, 2, "tblob", DB2_PARAM_FILE, DB2_BINARY, DB2_PARAM_IN);
db2_execute ($stml);
db2_commit ($conn);

$sql = "select count(*) from  test_blob";
$stml = db2_exec ($conn, $sql);
while ($res = db2_fetch_array($stml)) {
   var_dump ($res);
}

?>
 [2007-03-07 16:49 UTC] cathy dot kimbrel at gwinnettcounty dot com
In my EXCEL 2003 spreadsheet I am unable to insert a comment in an unprotected cell when the page itself is protected. What can I do without having to unprotect the page, add the comment and then reprotect the page?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC