• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.

Thanks.
 
author
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.

Cheers,
Clinton
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic