EJB design: Guidance on storing images in Oracle
Hi there !
- Posted by: Priyank Desai
- Posted on: March 30 2005 03:19 EST
I want guidance on storing and retrieving FITS (.fts) images in Oracle 9i. I am using JSP with Oracle. We are developing a website from where one can retrieve and upload Star images (which are in FITS format) from/to our database.
Thanks a lot !
Use your favourite method to upload files into the webserver. Store the file in a BLOB field in your DB.
Google the correct way to store a BLOB field in Oracle. There're a couple things to consider....
Cheers and happy coding,
You can use jakarta commons fileupload component to upload the file to server. For more information on how to use it, visit http://jakarta.apache.org/commons/fileupload/using.html. At Server side, you take the uploaded file as byte and store it in oracle database. You can use BLOB data type for a field in table to store the uploaded image. Using PreparedStatement, store the byte  into BLOB column.
Is it possible give me examples code ?
This isn't EJB related, nor directly usable in the frameworks/tools that you probably use, but in the CMF of RIFE we have code that does exactly this. That's why I point you to the following source file:
With some transposing to whatever you're using, you should be able to extract the SQL/JDBC code from there to store / retrieve blog into/from Oracle.