File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Oracle Blob using Java help (Error: JVM_recv in socket input stream read ) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Oracle Blob using Java help (Error: JVM_recv in socket input stream read )" Watch "Oracle Blob using Java help (Error: JVM_recv in socket input stream read )" New topic
Author

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

Rashmi Banthia
Ranch Hand

Joined: Dec 22, 2003
Posts: 79
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

Joined: Dec 22, 2003
Posts: 79
I figured this, I was using thin driver instead of OCI. With OCI (for >4K blobs) it works fine.
Regards,
Rashmi
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Oracle Blob using Java help (Error: JVM_recv in socket input stream read )
 
Similar Threads
init.ora parameter HELP
Java : Clob : Help!
ERROR: java.lang.OutOfMemoryError: Java heap space
Error writing greater than 4000 chars to CLOB
Storing blob > 4kb in oracle db through jdbc