Re: DBD::ODBC adding blob data error to Informix Db
Posted in 1998
Topics: SQL Development & Query Writing, Connectivity: ODBC / JDBC / .NET, Data Types & Schema Design
I have tried using $quotedblob = $dbh->quote($blobdata); $sth = $dbh->do("insert into test (name,age,type,tblob) values ('Fred Bloggs', '98', 'A', $quotedblob)"); and this seems to work for the TEXT data type, but I get a Syntax error for the BYTE data type. Still need help Thanks Andy In article <6tqkf9$dfv$1@nnrp1.dejanews.com>, andy_williams@my-dejanews.com wrote: > I get the following error when attempting to add blob data to my informix > database via my perl script. This only happens using INTERSOLV 3.01 32bit ODBC > driver. It works > using version 2.80 (Unfortunately I have an other problem with this driver). > > "DBD::ODBC::st execute failed: [INTERSOLV][ODBC Informix > driver][Informix]Illegal attempt to convert Text/Byte blob type." > > The code is listed below. > > Please help > > Andy > > print "Reading data...\\n"; > open(FH, "test.txt") or die "$!\\n"; > @lines = <FH>; > close FH; > $blobdata = join("",@lines); > undef @lines; > > print "Create Table......."; > $sth = $dbh->prepare("create table test \\(name CHAR\\(20\\) PRIMARY KEY, age > INTEGER, type CHAR\\(1\\) DEFAULT 'A', tblob TEXT in TEXT1\\)"); > die "Prepare failed " . $dbh->errstr . "\\n" if $dbh->errstr; > $sth->execute; > die "Execute failed " . $dbh->errstr . "\\n" if $dbh->errstr; > print "Ok\\n\\n"; > > $sth = $dbh->prepare("insert into test \\(name,age,type,tblob\\) values \\('Fred > Bloggs', '98', 'A', ?\\)"); die "Prepare failed " . $dbh->errstr . "\\n" if > $dbh->errstr; $sth->execute($blobdata); die "Execute failed " . $dbh->errstr > . "\\n" if $dbh->errstr; # The Error occurs # Here print "Ok\\n\\n"; > > -----== Posted via Deja News, The Leader in Internet Discussion ==----- > http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum > -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum