Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

NiFi, PutDatabaseRecord: Handling NULL

NiFi, PutDatabaseRecord: Handling NULL

Explorer

I have a problem inserting NiFi Records with null values into Sybase ASE and IQ with PutDatabaseRecord (version 1.5.0.3). I am using jconn4.jar and com.sybase.jdbc4.jdbc.SybDriver for connecting.

The affected column in the database is set to allow null, and works fine when inserting values if not null. But if null in the Record, like this

[ { "field1" : "abcd", "field2" : null } ]

it fails with this message:

PutDatabaseRecord[id=d1fb33c6-8b72-18b0-95f9-6c437879ff44] Failed to process StandardFlowFileRecord[uuid=8bb1975a-c169-4a6f-8b48-98225f346a75,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1551948944283-259989, container=default, section=917], offset=16640, length=47016],offset=0,name=XXX,size=47016] due to JZ0SE: Invalid object type (or null object) specified for setObject().: 

That error is described by Sybase as

JZ0SE: Invalid object type specified for setObject(). Description: Illegal type argument passed to PreparedStatement.setObject. Action: Check the JDBC documentation. The argument must be a constant from java.sql.Types.

Is there somewhere a bug where setNull() should have been called for NULL values instead of setObject()? No clue where or how to fix.

Can anyone help?

Don't have an account?
Coming from Hortonworks? Activate your account here