Skip to Content.
Sympa Menu

freetds - Re: [freetds] problem with retrieving blobs from mssql2k

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "William Fulmer" <WFulmer AT northampton.edu>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] problem with retrieving blobs from mssql2k
  • Date: Wed, 26 Apr 2006 21:44:53 -0400

Works! Thanks very much.

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


>>> jklowden AT freetds.org 4/26/2006 9:33 PM >>>
William Fulmer wrote:
> 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.

Quoth Michael Peppler on April 6, 2006:

> Try setting $dbh->{syb_binary_images} = 1 and rerun the query.

Please try that and let us know.

HTH.

--jkl
(japh)


> 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
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page