NIFI-4279 PutDatabaseRecord and ConvertJSONToSQL stream has already been closed error on Oracle

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes #2874
This commit is contained in:
patricker 2018-07-10 11:28:40 -06:00 committed by Matthew Burgess
parent bef91008bb
commit e13602f752
2 changed files with 5 additions and 4 deletions

View File

@ -907,14 +907,15 @@ public class ConvertJSONToSQL extends AbstractProcessor {
for (int i = 1; i < md.getColumnCount() + 1; i++) { for (int i = 1; i < md.getColumnCount() + 1; i++) {
columns.add(md.getColumnName(i)); columns.add(md.getColumnName(i));
} }
// COLUMN_DEF must be read first to work around Oracle bug
final String defaultValue = resultSet.getString("COLUMN_DEF");
final String columnName = resultSet.getString("COLUMN_NAME"); final String columnName = resultSet.getString("COLUMN_NAME");
final int dataType = resultSet.getInt("DATA_TYPE"); final int dataType = resultSet.getInt("DATA_TYPE");
final int colSize = resultSet.getInt("COLUMN_SIZE"); final int colSize = resultSet.getInt("COLUMN_SIZE");
final String nullableValue = resultSet.getString("IS_NULLABLE"); final String nullableValue = resultSet.getString("IS_NULLABLE");
final boolean isNullable = "YES".equalsIgnoreCase(nullableValue) || nullableValue.isEmpty(); final boolean isNullable = "YES".equalsIgnoreCase(nullableValue) || nullableValue.isEmpty();
final String defaultValue = resultSet.getString("COLUMN_DEF");
String autoIncrementValue = "NO"; String autoIncrementValue = "NO";
if(columns.contains("IS_AUTOINCREMENT")){ if(columns.contains("IS_AUTOINCREMENT")){

View File

@ -1080,14 +1080,14 @@ public class PutDatabaseRecord extends AbstractSessionFactoryProcessor {
for (int i = 1; i < md.getColumnCount() + 1; i++) { for (int i = 1; i < md.getColumnCount() + 1; i++) {
columns.add(md.getColumnName(i)); columns.add(md.getColumnName(i));
} }
// COLUMN_DEF must be read first to work around Oracle bug
final String defaultValue = resultSet.getString("COLUMN_DEF");
final String columnName = resultSet.getString("COLUMN_NAME"); final String columnName = resultSet.getString("COLUMN_NAME");
final int dataType = resultSet.getInt("DATA_TYPE"); final int dataType = resultSet.getInt("DATA_TYPE");
final int colSize = resultSet.getInt("COLUMN_SIZE"); final int colSize = resultSet.getInt("COLUMN_SIZE");
final String nullableValue = resultSet.getString("IS_NULLABLE"); final String nullableValue = resultSet.getString("IS_NULLABLE");
final boolean isNullable = "YES".equalsIgnoreCase(nullableValue) || nullableValue.isEmpty(); final boolean isNullable = "YES".equalsIgnoreCase(nullableValue) || nullableValue.isEmpty();
final String defaultValue = resultSet.getString("COLUMN_DEF");
String autoIncrementValue = "NO"; String autoIncrementValue = "NO";
if (columns.contains("IS_AUTOINCREMENT")) { if (columns.contains("IS_AUTOINCREMENT")) {