Search code examples
javabeansoracle9i

Selection of datatype for storing images


I want to store and retrieve images to/from database using java beans, which data type should be used for this purpose?


Solution

  • The most conventional approach would be to store the data in a BLOB. That would allow you to read and write the byte stream from Java but wouldn't allow you to do any transformation inside the database.

    The other alternative would be to use the interMedia ORDImage type. This provides a great deal more flexibility by allowing the database to do things like generate and return a thumbnail image, to adjust compression quality, etc.

    As Grant indicates, LONG RAW (and the character-based LONG) data types have been deprecated so you should not be using them.