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.

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

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.

Appreciate the help,
Yaron. 

-----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
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to