[ https://issues.apache.org/jira/browse/NIFI-4842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16538984#comment-16538984 ]
Peter Wicks commented on NIFI-4842: ----------------------------------- [~Max Kelada] I'm closing this as a duplicate, but I really appreciate your research into this issue. I'll submit your bug fix based upon your research. Will be good to have help testing. Please reference NIFI-4279 going forward. > PutDatabaseRecord throws "stream has all ready been closed" with oracle > default values > -------------------------------------------------------------------------------------- > > Key: NIFI-4842 > URL: https://issues.apache.org/jira/browse/NIFI-4842 > Project: Apache NiFi > Issue Type: Bug > Components: Extensions > Affects Versions: 1.5.0 > Environment: Oracle > Reporter: Max Kelada > Priority: Minor > Labels: database, nifi, oracle, processor > > 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. > [https://blog.jooq.org/2015/12/30/oracle-long-and-long-raw-causing-stream-has-already-been-closed-exception/] > > 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 -- This message was sent by Atlassian JIRA (v7.6.3#76005)