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

Inserting image into the oracle database

 
Anirban dutta
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I insert an array of bytes obtained from an image into an Oracle BLOB type column using JDBC 2.0 type 4 driver?
Thanks
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JDBC Forum
 
Murali Nanchala
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have already extracted the byte array for the image, then try

You can also look at setBlob() method of the xxxxxxxxStatement object you use.
 
Anirban dutta
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried out the method of the setBlob. But the problem is how to get the reference of the Blob interface. I couldn't find any code which returns the Blob's reference.
So I tried it in a different way:
I inserted a empty image into the database by empty_blob() function of SQL. Then I used the setBytes of the blob interface to set the image bytes in it. But it gave an runtime exception:
java.lang.AbstractMethodError.
What could be the problem. Please help me in solving it.
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this post: http://www.coderanch.com/t/79988/Oracle-OAS/Inserting-BLOB
Rene
 
Sandeep Ghosh
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is how I have done
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic