>
> Thanks for the help Jeff, I will certainly try it.
>
> I couldn't find the latest DBD::ODBC (0.39) on CPAN though, the latest I
> saw is 0.38.

I'll attach it here, just in case.  .39 should have made it as I've seen a
few patches for building with it already...:(

>
> One question, can you explain a little further on why MD5 encryption
> should be used in this case? Is that necessary ?

It was for my *sample* (not necessary for production) to ensure the data I
was putting in was the same as I get out.  You probably don't need it, but
you should test with it just to be sure before you assume the files you put
in are good.  The bind types for some of the DBs really require testing
sanely first.  Note that Access needs a "special" over-ride on the bind type
to work correctly for "long" binary files.  I tried it with 5K and 150K .TIF
files and it worked OK as written with DBD::ODBC >= .37, I think.  The
script assumes the "new" code for automatically detecting the bind type.  I
think for some near future version, if I don't get any complaints, I'll make
that the default which will be better.

>
> BTW, I'm using MS Sql Server 2000 and I'll manage the ASP side if I can
> get DBI to work. I will be glad to post a working example once I get it
> done.

That would be great.

>
> Appreciate the help,
> Yaron.

Not a problem.

Jeff

>
> -----Original Message-----
> From: Jeff Urlwin [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 05, 2002 6:11 AM
> To: Yaron Langer; [EMAIL PROTECTED]
> Subject: RE: DBI and Blobs
>
>
> In the latest DBD::ODBC distribution on CPAN is a script which, from the
> command line, uses the *latest* DBD::ODBC (I'm not sure if ActiveState
> has caught up yet) to take a list of files on the command line and put
> them into the database and retrieve them.  The LongReadLen is a *MAX*
> length for the read and you can probably estimate the size a bit safely.
> The LongReadLen, however, dictates how much memory is used when reading
> (not writing) a long value.  The script is in mytest\longbin.pl, which
> has been tested for Access 2000, SQLServer 2000 and Oracle 8.1.7 with
> their respective ODBC drivers.
>
> If you do not have the latest DBD::ODBC (0.39) or you are using Access,
> then make sure you bind_param to the right SQL Type.  For Access
> SQL_LONGVARBINARY worked for me.  Test that program with your database
> and your images before going too much further.  What it does is insert
> the image data, compute an MD5 value, then read the data from the
> database and retake the MD5 data.  If the MD5 values don't match, then
> there is something wrong. If they match, you got out what you put in.
>
> That will handle the DBI side for you.  I can't help you with the ASP
> side, though.
>
> I would include in the DBD::ODBC distribution any
> contributions/modifications to the script which test more databases and
> would be *happy* to have someone creat an ASP/web example for
> uploading/downloading images.  I think that would be a useful sample to
> many.
>
> Regards,
>
> Jeff
>
> >
> >
> > Hello,
> >
> > I have an asp application which I wrote using Perl and DBI. Recently I
>
> > did some code improvements and implemented all functions using
> > PerlCtrl into one dll file. The only thing I left for last is two
> > pages which are used for upload and download attachments. Currently
> > these pages are coded in VB since at the time I wrote it I couldn't
> > find any useful example on how to implement this with Perl. I'd really
>
> > like to convert them to Perl preferably with DBI and not ADO.
> >
> > From the DBI docs it seems the only way to read blobs is by using
> > these
> > two:
> >
> > $dbh->{LongReadLen}   = <size>;
> > # And optionaly ..
> > # $dbh->{LongTruncOk}   = 1;
> >
> > And apparently if the blob size is bigger than the size specified in
> the
> > $dbh->{LongReadLen} attribute the  $dbh->{LongTruncOk}   = 1 will skip
> > the error but will actually make the binary file unusable.
> >
> > I wonder if someone can give me a hand here and provide me with a
> > working example on how to read and write blobs using DBI on ASP page.
> >
> > Thanks,
> > Yaron.
> > _______________________________________________
>
>
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

Attachment: longbin.pl
Description: Binary data

Reply via email to