Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Blob and Clob in iBatis

Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
How can we use Blob and Clob in iBATIS OR Mapping.

Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My personal feeling is that if the data type is BLOB or CLOB, it's probably too big to be keeping around in memory anyway. In general, with these types, you want to either stream them directly to the browser, or stream them to a file on disk (good for caching) and then let the browser download the file directly. Those are the appproaches I recommend, and for those, you should use straight JDBC (not iBATIS, Hibernate or any other tool).

With that little disclaimer out of the way....

In some cases, it makes sense to map small BLOBs (avatar images) and CLOBs (text that blows the 255 or 65k char limit of some DBs). CLOB is the most common case, and iBATIS can do that simply by specifying a String Java type and a CLOB or LONGVARCHAR JDBC type. For BLOB, you must map a Java property of type byte[] (byte array) to a JDBC type of BLOB or LONGVARBINARY.

I recommend using iBATIS 2.3.

Note to Oracle users: for BLOB and CLOB you must use Oracle 10g drivers, as previous to that version they did not support the standard JDBC *LOB interface. The 10g drivers can be used with older Oracle databases, or at least with 9i.

Lasagna is spaghetti flvored cake. Just like this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic