You are getting binary data back, what did you expect?  The field stores
binary, so you are getting whatever you are asking for.  I don't know how
cold fusion handles it's types.  One way to test is to try to store an
actual binary file (image or some doc) in it, retrieve and output the
correct content-type, then see if that file still works.

Also, not sure if you are already doing so, but use

binmode STDOUT;
binmode STDIN;

at beginning of your script.

Ilya

-----Original Message-----
From: John
To: [EMAIL PROTECTED]
Sent: 4/15/02 12:54 PM
Subject: Storing text in SQLServer image column

I need to store more than 9,000 bytes of text in a column in a SQL 
Server database and use ColdFusion to extract the data.  I have been 
trying with an image column.  When I query wtih cfm i get a bunch 
of gibberish, I can't tell if the insert isn't working or if the 
query can't handle the binary results.

I'm sure these problems (both insert and cfm query) have been solved 
and at least the Perl one posted to the list but I can't find searchable

archives.  I guess one alternative is to store the data in an include 
file and the address of the include in the database, but I would 
like to avoid this.

I have been having trouble subscribing to this list - please respond 
directly.

Thanks in advance,

   -John

So far the closest code I think I have written is this (no errors 
reported at insert - error trapping removed):

my $long = "A23456789B" x 1000;
$long = $dbh->quote( $long, SQL_LONGVARBINARY );
my $sql = "INSERT INTO TestImage( ImageType ) VALUES ( ? )";
my $sth = $dbh->prepare( $sql );
$sth->bind_param( 1, $long, { TYPE => SQL_LONGVARBINARY } );
my $ret = $sth->execute( $long );






Reply via email to