Discussions

EJB design: Guidance on storing images in Oracle

  1. Guidance on storing images in Oracle (4 messages)

    Hi there !

    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.

    Please advise.

    Thanks a lot !

    Priyank Desai

    Threaded Messages (4)

  2. 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,
    Martin
  3. Hi Priyank,

    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.

    Anil.
  4. Examples[ Go to top ]

    Is it possible give me examples code ?
  5. Examples[ Go to top ]

    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:
    http://svn.rifers.org/rife/trunk/src/framework/com/uwyn/rife/cmf/dam/contentstores/imagestoredrivers/oracle_jdbc_driver_OracleDriver.java

    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.