[
https://issues.apache.org/jira/browse/NIFI-2591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15435025#comment-15435025
]
ASF GitHub Bot commented on NIFI-2591:
--------------------------------------
Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/883#discussion_r76068439
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutSQL.java
---
@@ -787,6 +802,29 @@ private void setParameter(final PreparedStatement
stmt, final String attrName, f
stmt.setTimestamp(parameterIndex, new
Timestamp(lTimestamp));
break;
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ byte[] bValue;
+
+ switch(valueFormat){
+ case "":
+ case "ascii":
--- End diff --
How about cases for UTF-8 and UTF-16? Since the case just calls getBytes()
with a charset name, we could support any/all of the ones in
[StandardCharsets](https://docs.oracle.com/javase/8/docs/api/index.html?java/nio/charset/StandardCharsets.html).
I found this while putting smileys in sql.args.N.value, the default handling
will treat every byte as a 63.
> PutSQL has no handling for Binary data types
> --------------------------------------------
>
> Key: NIFI-2591
> URL: https://issues.apache.org/jira/browse/NIFI-2591
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Reporter: Peter Wicks
>
> PutSQL does not call out binary types for any special treatment, so they end
> up being routed through stmt.setObject.
> The problem is that upstream processors have formatted the binary data as a
> string and the JDBC driver doesn't know what to do with a string going into a
> binary field.
> Investigation into the AvroToJSON processor shows that if users are trying to
> load data exported from a source system as Avro Binary that Avro encodes the
> binary data into ASCII (One byte per character).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)