File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Blob and Clob in iBatis

 
Kriti Garg
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
How can we use Blob and Clob in iBATIS OR Mapping.

Thanks.
 
Clinton Begin
author
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic