You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/04/05 15:19:29 UTC

[GitHub] [nifi] mattyb149 commented on a change in pull request #3410: NIFI-6100 Use setBytes in JdbcCommon for binary types

mattyb149 commented on a change in pull request #3410: NIFI-6100 Use setBytes in JdbcCommon for binary types
URL: https://github.com/apache/nifi/pull/3410#discussion_r272634506
 
 

 ##########
 File path: nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java
 ##########
 @@ -807,7 +807,7 @@ public static void setParameter(final PreparedStatement stmt, final String attrN
                             throw new ParseException("Unable to parse binary data using the formatter `" + valueFormat + "`.",0);
                     }
 
-                    stmt.setBinaryStream(parameterIndex, new ByteArrayInputStream(bValue), bValue.length);
+                    stmt.setBytes(parameterIndex, bValue);
 
 Review comment:
   How about we try the `setBinaryStream` first, then if it throws a `SQLFeatureNotSupportedException` we try `setBytes`? This might prevent a regression if there is some other driver (not Phoenix) that supports setBinaryStream and not setBytes. This code is used by many folks with many different drivers/DBs, so I'd like to minimize the chance for regressions. Thoughts?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services