• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Oracle Blob using Java help (Error: JVM_recv in socket input stream read )

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to insert a record with Blob column (size of image 'mg.jpg' about 15KB) and I get the runtime error:
[java] java.sql.SQLException: Io exception: Connection reset by peer: JVM_recv in socket input stream read
[java] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
[java] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
[java] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
[java] at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2061)
[java] at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
[java] at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
[java] at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
[java] at test.ProvisioningParser.TestBlob.main(Unknown Source)

This is what code looks like: I am not sure what's wrong, any help appreciated. Thanks!
try{

Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc racle:thin:@VALUED-20606295:1521 bbook","jvending","jvending");


java.util.zip.ZipInputStream zip = new java.util.zip.ZipInputStream(new java.io.FileInputStream(new java.io.File("D:\\work\\mywork\\source\\test\\ProvisioningParser\\test.par"))) ;
int len = 0 ;
java.util.zip.ZipEntry entry = null;
do{
entry = zip.getNextEntry();
if (entry != null){
if (entry.getName().equalsIgnoreCase("mg.jpg")){
len = (int)entry.getSize();
break;
}
}
}while(entry!=null) ;

stmt = con.prepareStatement( "Insert into icon (parid, clientbundleid, id, iconfile ) values ( ?,?,?,?)"
);
stmt.setString(1,"101");
stmt.setString(2,"101");
stmt.setInt(3,1);
stmt.setBinaryStream( 4, zip, len);
stmt.setQueryTimeout(0);
stmt.executeUpdate();

con.close();
}
catch(Exception e){
e.printStackTrace();
}

Thanks,
Rashmi
 
Rashmi Banthia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I figured this, I was using thin driver instead of OCI. With OCI (for >4K blobs) it works fine.
Regards,
Rashmi
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic