From 88fc8d28a0502fa7d66662d6646f31cf33e131be Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Sun, 18 Oct 2015 22:57:04 -0400 Subject: [PATCH] NIFI-1010: If database driver does not support getting table name for column from ResultSetMetadata, then just use a default name --- .../apache/nifi/processors/standard/util/JdbcCommon.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java index 6fc69ff4bc..753513b96a 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java @@ -51,6 +51,7 @@ import org.apache.avro.generic.GenericData; import org.apache.avro.generic.GenericDatumWriter; import org.apache.avro.generic.GenericRecord; import org.apache.avro.io.DatumWriter; +import org.apache.commons.lang3.StringUtils; /** * JDBC / SQL common functions. @@ -95,7 +96,10 @@ public class JdbcCommon { public static Schema createSchema(final ResultSet rs) throws SQLException { final ResultSetMetaData meta = rs.getMetaData(); final int nrOfColumns = meta.getColumnCount(); - final String tableName = meta.getTableName(1); + String tableName = meta.getTableName(1); + if (StringUtils.isBlank(tableName)) { + tableName = "NiFi_ExecuteSQL_Record"; + } final FieldAssembler builder = SchemaBuilder.record(tableName).namespace("any.data").fields();