aspose file tools*
The moose likes Servlets and the fly likes Problems with file upload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problems with file upload" Watch "Problems with file upload" New topic
Author

Problems with file upload

sovan chatt
Ranch Hand

Joined: Aug 09, 2010
Posts: 43

When I run this code I get the following error messge java.sql.SQLException: Io exception: Connection reset by peer: socket write error.and when I try to retrieve the blob object I get a Nullpointer Exception.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

So it's not really a file upload problem, but a DB issue?
sovan chatt
Ranch Hand

Joined: Aug 09, 2010
Posts: 43
@David Newton Yes ..that might be the case but what should I do?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


Connection reset by peer

This usually means the server itself has deliberately dropped the connection. What database are you using?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Deepak Kumar Jena
Ranch Hand

Joined: Sep 08, 2010
Posts: 68

@Sovan, What I think is you are trying to upload a file of larger size and your system is unable to keep a connection open long enough to upload the file successfully, try with small size files. While retrieving the BLOB object you are getting the NullPointerException, because you are trying to retrieve an object which does not exists (As the file is failing to upload in your case).


dkj4jdk
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

If this were the case I would expect the error to report a transaction time out. It should be easy to confirm by checking the database logs.
sovan chatt
Ranch Hand

Joined: Aug 09, 2010
Posts: 43
@Deepak Kumar Jena,@Paul Sturrock...I am using Oracle 9i...I tried to upload files of around 350Kb and still its not working...What should I do?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

OK, what data type are you using to store the binary content and which driver version are you using?
sovan chatt
Ranch Hand

Joined: Aug 09, 2010
Posts: 43
@Paul Sturrock I am using 'blob' object to store binary data and Oracle thin type 4 driver...
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What version of driver (not type)? Oracle's 9i drivers were less than perfect - from memory (though this may only apply to LONG RAW data types) you needed to be careful what order you bound binary content variables.

If you are not already doing this, try swapping to the latest 11g driver.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

And maybe store the Blob in the right way, by using empty_blob()

Look at the sample code here: http://www.idevelopment.info/data/Oracle/DBA_tips/LOBs/LOBS_12.shtml

Methods in the samples of interest are: writeBLOBPut() or writeBLOBStream()


Regards, Rene Larsen
Dropbox Invite
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with file upload