I'm using Apache NiFi 1.5.0 with the latest release of the JTDS driver to access a MS SQL Server instance. When NiFi encounters a Clob field, it throws an error when attempting to free() the clob object.
java.lang.AbstractMethodError: null
at net.sourceforge.jtds.jdbc.ClobImpl.free(ClobImpl.java:219)
at org.apache.nifi.processors.standard.util.JdbcCommon.convertToAvroStream(JdbcCommon.java:288)
at org.apache.nifi.processors.standard.ExecuteSQL$2.process(ExecuteSQL.java:230)
I thought this was a NiFi bug at first, so a lot of my research on this is detailed on the Apache issue tracker in NIFI-4974.
It looks like the problem might be in jTDS, because free()
should throw SQLFeatureNotSupportedException
, not AbstractMethodError
, when it's not implemented.
We're going to try to use the MS SQL driver as a workaround…
The workaround for this while still using JTDS is to add
useLOBs=false;
in the connection string.The problem is here: https://sourceforge.net/p/jtds/code/HEAD/tree/branches/jTDS%201.3%20%28stable%29/src/main/net/sourceforge/jtds/jdbc/ClobImpl.java#l217
Inspiration for the workaround:
https://stackoverflow.com/questions/31562700/net-sourceforge-jtds-jdbc-clobimpl-cannot-be-cast-to-java-lang-stringjtds