File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with file upload

 
sovan chatt
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it's not really a file upload problem, but a DB issue?
 
sovan chatt
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@David Newton Yes ..that might be the case but what should I do?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Connection reset by peer

This usually means the server itself has deliberately dropped the connection. What database are you using?
 
Deepak Kumar Jena
Ranch Hand
Posts: 68
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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).
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, what data type are you using to store the binary content and which driver version are you using?
 
sovan chatt
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Paul Sturrock I am using 'blob' object to store binary data and Oracle thin type 4 driver...
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic