• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Problems with file upload

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So it's not really a file upload problem, but a DB issue?
 
sovan chatt
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@David Newton Yes ..that might be the case but what should I do?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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()
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic