最近kettle中的幾個轉換拋出如下異常:
Because of an error, this step can't continue:
org.pentaho.di.core.exception.KettleException:
Error inserting row into table [BOND_ISSUE] with values: [291209410397], [8067], [8067], [中國普天信息產業股份有限公司2009年度第一期短期融資券], [6], [1], [1420], [2], [2009/03/24 00:00:00.000], [中國普天信息產業股份有限公司], [99], [null], [null], [聯合資信評估有限公司、中誠信國際信用評級有限公司], [A-1], [中國光大銀行股份有限公司],
[2], [2009/03/24 00:00:00.000], [全國銀行間債券市場機構投資者(國家法律、法規禁止購買者除外)。], [\利率招標\簿記建檔\], [100], [1000000], [null], [2009/03/30 00:00:00.000], [2009/03/31 00:00:00.000], [800000000], [800000000], [null], [2009/04/01 00:00:00.000], [89], [null], [null], [2010/03/26
00:00:00.000], [2011/05/30 10:02:49.000], [360064768821], [null], [null], [null], [null], [null]
Unexpected error inserting row
-32363
at org.pentaho.di.trans.steps.tableoutput.TableOutput.writeToTable(TableOutput.java:445)
at org.pentaho.di.trans.steps.tableoutput.TableOutput.processRow(TableOutput.java:128)
at org.pentaho.di.trans.step.RunThread.run(RunThread.java:50)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.pentaho.di.core.exception.KettleDatabaseException:
Unexpected error inserting row
-32263
at org.pentaho.di.trans.steps.tableoutput.TableOutput.writeToTable(TableOutput.java:341)
... 3 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: -32263
at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2677)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9270)
at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:210)
at org.pentaho.di.trans.steps.tableoutput.TableOutput.writeToTable(TableOutput.java:315)
... 3 more
報錯的是一個 表輸出 組件
解決方式: 表輸出組件默認爲使用批量插入,數量爲1000條。將1000條修改爲500條,轉換就可以正常執行了。
分析:看樣子是 ojdbc的bug。當前用的是ojdbc6。已經是最新的ojdbc了。報問題的時機都是在已經batch到庫中1000條,進行第二個1000條插入的時候就報錯了
所以認爲跟batch的記錄條數有關係。降低條數後果然不再報錯。因爲異常中有 java.lang.ArrayIndexOutOfBoundsException: -32263 。我猜測ojdbc用一維數組保存了
batch條數 x 記錄列數 。當batch很大時,超出了整數能表示的數組下標最大值時,ojdbc報錯。