Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Duplicate
-
1.5.0
-
None
-
Oracle
-
Patch
Description
When inserting into an oracle database (using ojdbc7 as the driver),
to a table with one of its fields has a default value, the putdatabaserecord processor throws "stream has already been closed" exception.
i explored the problem for quite, even going as far as taking the code and debugging it on my pc
after a little bit of time i figured out what the problem was.
The problem occurs while getting the TableSchema from the database (line 1018)
the DataBaseMetaData .getColumns method returns a result set of the descriptions of all the columns of the table, including the defaultvalue, which comes as a LONG typed variable
when trying to create a ColumnDescription object from the result set it gets values such as the name of the column, datatype and default value
But duo to a low level oracle protocol flaw you cannot fetch LONG typed columns from the database unless it comes before any of the other cloumns.
to fix this i just moved line number 1088
final String defaultValue = resultSet.getString("COLUMN_DEF");
to one line before line 1082
final String columnName = resultSet.getString("COLUMN_NAME");
i know it's a weird problem, and even a weirder solution.
I would appreciate it greatly if you could make this upgrade to the PutDatabaseRecord processor
Attachments
Issue Links
- Blocked
-
NIFI-4279 PutDataBaseRecord and ConvertJSONToSQL stream has already been closed
- Resolved