OK, I promised to post an update. It took longer than I imagined but here at last...
Firstly, the case with IBM confirmed that Java UDFs can return LOB data types. The documentation that says otherwise is out-of-date, and will be fixed later on. Thank you to Jian in the support team and the developers who looked into this.
Secondly, I've done a fair bit of testing, and tuned buffer sizes with dramatic improvements. A couple of conclusions:
1) If you want to work with BLOBs larger than 64MB you will need to increase JAVA_HEAP_SZ.
2) On my laptop running Db2 on Ubuntu, an uncompressed 25MB JSON document compresses 6.8x in about 2 seconds, and uncompresses in about 1 second. Performance is now perhaps adequate for archive databases of an appropriate design (my requirement likely to be that), but I would not suggest using this in any database where response matters.
3) Smaller LOBs containing similar data run faster, more-or-less proportional to size.
Lastly, a first "official" release! Release 0.1, see: https://github.com/easydataservices/db2-compress
Please read the notes in the README, and be sure to test this works well for you before deploying.
------------------------------
Jeremy Rickard
------------------------------
Original Message:
Sent: Tue February 21, 2023 08:57 AM
From: Jeremy Rickard
Subject: Java UDFs to compress and uncompress BLOBs:
Hi,
Java development pages seem to omit mentioning this, the code seems to work well, and no SQLSTATE 429B8 is returned. So I am inclined to think this documented restriction is out-of-date?
Any insider comments? Also interested in any concerns about using sqlj.runtime.ref.DefaultContext.getDefaultContext().getConnection() inside a JDBC Java UDF to create the output Blob. Again this seems to work fine, and using a Db2 Java Blob instead of SerialBlob is more efficient.
Jeremy Rickard