Tuesday, March 17, 2009

LOB in Hibernate over DB2 9.5

Using BLOB/CLOB in hibernate may cause exceptions complaining "LOB closed" when running on top of DB2 (see Hibernat Users FAQ). The reason can be the progressive streaming feature of DB2.

There are two solutions:

  1. Use iterate() of ResultSet and load LOB content during each iteration.
  2. Disable progressive streaming by specifying options in the JDBC url:
    jdbc:db2://localhost:50000/DatabaseName:fullyMaterializeLobData=false;progressiveStreaming=2;progresssiveLocators=2;
    Please note: fullMaterializeLobData is set to false, which enables lazy loading.

No comments: