Re: Inserting LOB into DB2 in pieces
- From: bongtumanut@xxxxxxxxx (Bong Tumanut)
- Date: Thu, 6 Mar 2008 21:10:50 -0800 (PST)
No, I didn't mean to imply that the web user's file has already been uploaded and saved in a file on the Apache server.
Good point about the multiple trips between the Apache server and the DBMS. Although the 1024 was arbitrary, I could have made that bigger like 32K.
Thanks for the feedback.
Jonathan Leffler <jonathan.leffler@xxxxxxxxx> wrote: On Thu, Mar 6, 2008 at 8:25 PM, Bong Tumanut wrote:
I'm writing an Apache::ASP program to upload a file and store it in a LOB
column in DB2. Is there a way to store the uploaded file in pieces, i.e.
while(read($filehandle, $data, 1024))
{
# data from the uploaded file read into $data
# load all $data into a LOB column
};
I know the uploaded file can be stored in a file and then the file, in
turn, is bound to a LOB column. But this is extra processing.
I also know that I can store the whole file in a variable but that could
take up a lot of memory.
Round trips to the database are expensive too. I'd go with store the whole
LOB in a file and then bind that to the LOB - it will be be less stress on
the system overall, I think. It depends slightly on the size of the files
on average, but if you're going to do more than two round trips in fragments
(more than 2 KB files/LOBs), then you should think again.
Also, your comments imply the data is already in an uploaded file - so
aren't you making busy work for yourself?
And, I strongly suspect this would apply to any DBMS where the client is in
a separate process from the DBMS.
--
Jonathan Leffler #include
Guardian of DBD::Informix - v2008.0229 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
bong@xxxxxxxxxxx
- References:
- Re: Inserting LOB into DB2 in pieces
- From: Jonathan Leffler
- Re: Inserting LOB into DB2 in pieces
- Prev by Date: Re: Inserting LOB into DB2 in pieces
- Next by Date: Re: DBD::Oracle - execute_array core dumps intermittently
- Previous by thread: Re: Inserting LOB into DB2 in pieces
- Next by thread: What causes this 32 bit problem??
- Index(es):
Relevant Pages
|
|