Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing blob > 4kb in oracle db through jdbc

 
IM Mahesh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,

I am facing problem to store a file data in oracle blob having file size grater than 4kb. However if i try to store file smaller than 4kb it's working fine.

I get following error.

java.sql.SQLException: Io exception: Software caused connection abort: socket write error
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:345)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2094)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1986)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2697)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:457)
at com.evermind.sql.FilterPreparedStatement.executeUpdate(FilterPreparedStatement.java:240)
at com.evermind.sql.FilterPreparedStatement.executeUpdate(FilterPreparedStatement.java:240)
at com.evermind.sql.FilterPreparedStatement.executeUpdate(FilterPreparedStatement.java:240)


What could be the solution for this?

Thanks in advance.


Mahesh
 
viju vi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi man,

even im getting the same kind of error, i tried all possible ways but its giving me the same error. you see if you try a file or data less than 4k it works well and fine but data which exceeds that you get this error. Can you post the code and which database you are trying to use...
 
viju vi
Greenhorn
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found one. database using oracle 8i

first what you do is get the OracleConnection instead of jdbc.Connection object. next insert a empty blob object into database then select the blob object that was inserted previously by using
for update
clause because we do update when we are fetching it.
now read the file and input it into the blob object.

hope below code might help.


hope this code helps you
 
Kajal Chakole
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it worked.. thanks viju vi.
i was also getting same exception in oracle10g with type 4 jdbc driver.
instead of overcoming the limitation of the existing driver by upgrading it, (cannot upload > 4k data) we can use this code with little modifications.


 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

You can use the code tag to make your code much more readable. I've added it for you this time, so you can see how much better it looks

Kajal Chakole wrote:instead of overcoming the limitation of the existing driver by upgrading it...

Upgrading the driver should be the first option. Even the newest driver is compatible with older databases (all the way back to 9i) and contains some important optimizations. See also our Oracle FAQ.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic