[freetds] problem with retrieving blobs from mssql2k

William Fulmer WFulmer at northampton.edu
Wed Apr 26 21:14:15 EDT 2006


I'm using perl DBD::Sybase. I used the directions in the User
documantation so whatever API that defaults to...
I'm querying a MSSql 2000 database.  If I've configured things
correctly I should be talking tds 7.0.

The code:
#!/opt/local/bin/perl
use strict;
use DBI;
use DBD::Sybase;

my $dbh = DBI->connect("dbi:Sybase:host=onecard;port=1433", 'user',
'password', {PrintError => 0}) or
        die "Unable for connect to server $DBI::errstr\n";
$dbh->do('use badgeimages') or die "Could not select database: " .
$dbh->errstr . "\n";
$dbh->do('set textsize 1000000') or die "Could not select database: " .
$dbh->errstr . "\n";
my $sth = $dbh->prepare('select pt_cardholder_id,pt_image from
portrait') or die $dbh->errstr . "\n";
$sth->execute() or die $sth->errstr . "\n";
while (my @pic = $sth->fetchrow_array()) {
  open OUTFILE,">",$pic[0] . ".jpg";
  print OUTFILE $pic[1];
  close OUTFILE;
  die;
}


---
Will Fulmer
Database Administrator
Northampton Community College
Bethlehem, PA
610-861-5569


>>> jklowden at freetds.org 4/26/2006 8:23 PM >>>
William Fulmer wrote:
> My
> problem is that the image fields I'm trying to retrieve are coming
out
> in hex rather than binary.  What am I doing wrong?

Likely you're asking for them as character data, whether or not you
mean
to.  

What language and API are you using?  

--jkl
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org 
http://lists.ibiblio.org/mailman/listinfo/freetds


More information about the FreeTDS mailing list