> -----Original Message-----
> From: Ivan Vasquez [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 20, 2004 1:04 PM
> To: [EMAIL PROTECTED]
> Subject: Uploading files to a database
> 
> 
> Hi,
> 
> What's the preferred way to upload files into a database in a J2EE Web
> application? 
> 
> Is there any way to stream the file straight from the 
> HttpServletRequest
> to the database without staging it in the server's filesystem? 

Since you have to have the entire file before saving it into the DB, you either store 
the entire file in memory, or put it on the filesystem.
I suppose you could, store the current buffer contents... read the next buffer full, 
re-get the field, append the new buffer to what's in the database, then update it.  
course, the only that does is beat the snot out of your database and the GC, since you 
still have to have enough memory to store the whole file in memory, plus bring it 
across the network (filesize/buffersize)*2 times.  The GC of course would have to run 
a lot as well, since you'd be dynamically allocating 2(filesize/buffersize) buffers.  
Your network traffic would be something like 2(filesize/buffersize)buffersize.
So.... ummmm unless your db has that option, and a JDBC connector that allowed it... 
no.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to