1

我正在执行从 oracle 9i 数据源到 Sql Server 2008 的数据迁移,但是由于此错误而失败:'Only dates between January 1, 1753 and December 31, 9999 are accepted.'
问题是在 Sql Server 2008 数据库上,我使用的是 datetime2 数据类型,它允许更广泛的日期. 这是 Spoon 显示的完整跟踪:

2016/04/13 15:45:21 - copy_maffiche_commune_to_s - ERROR (version 6.0.1.0-386, build 1 from 2015-12-03 11.37.25 by buildguy) : Errors detected!
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - ERROR (version 6.0.1.0-386, build 1 from 2015-12-03 11.37.25 by buildguy) : Because of an error, this step can't continue:
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - ERROR (version 6.0.1.0-386, build 1 from 2015-12-03 11.37.25 by buildguy) : org.pentaho.di.core.exception.KettleException: 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Error inserting row into table [AFFICHE_COMMUNE] with values: [25063], [24], [224], [49], [3], [0206/02/26 00:00:00.000], [0], [0], [null]
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - offending row : [NUM_DOSSIER Integer(6)], [INDICE String(3)], [CODE_SERVICE_FONCIER Integer(3)], [CODE_AFFICHAGE Integer(3)], [CODE_COMMUNE Integer(4)], [DATE_ETAPE Date], [REFERENCE Integer(4)], [NUMERO_DEPOT Integer(6)], [VOLUME_DEPOT String(10)]
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Error setting value #6 [Date] on prepared statement
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Only dates between January 1, 1753 and December 31, 9999 are accepted.
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at org.pentaho.di.trans.steps.tableoutput.TableOutput.writeToTable(TableOutput.java:377)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at org.pentaho.di.trans.steps.tableoutput.TableOutput.processRow(TableOutput.java:118)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at java.lang.Thread.run(Thread.java:744)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Caused by: org.pentaho.di.core.exception.KettleDatabaseException: 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - offending row : [NUM_DOSSIER Integer(6)], [INDICE String(3)], [CODE_SERVICE_FONCIER Integer(3)], [CODE_AFFICHAGE Integer(3)], [CODE_COMMUNE Integer(4)], [DATE_ETAPE Date], [REFERENCE Integer(4)], [NUMERO_DEPOT Integer(6)], [VOLUME_DEPOT String(10)]
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Error setting value #6 [Date] on prepared statement
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Only dates between January 1, 1753 and December 31, 9999 are accepted.
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at org.pentaho.di.core.database.Database.setValues(Database.java:1023)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at org.pentaho.di.trans.steps.tableoutput.TableOutput.writeToTable(TableOutput.java:254)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    ... 3 more
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Caused by: org.pentaho.di.core.exception.KettleDatabaseException: 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Error setting value #6 [Date] on prepared statement
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Only dates between January 1, 1753 and December 31, 9999 are accepted.
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - 
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at org.pentaho.di.core.row.value.ValueMetaBase.setPreparedStatementValue(ValueMetaBase.java:4867)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at org.pentaho.di.core.database.Database.setValue(Database.java:1005)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at org.pentaho.di.core.database.Database.setValues(Database.java:1021)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    ... 4 more
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 - Caused by: java.sql.SQLException: Only dates between January 1, 1753 and December 31, 9999 are accepted.
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at net.sourceforge.jtds.jdbc.DateTime.packDate(DateTime.java:318)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at net.sourceforge.jtds.jdbc.DateTime.<init>(DateTime.java:126)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setParameter(JtdsPreparedStatement.java:444)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setTimestamp(JtdsPreparedStatement.java:840)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setTimestamp(JtdsPreparedStatement.java:870)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    at org.pentaho.di.core.row.value.ValueMetaBase.setPreparedStatementValue(ValueMetaBase.java:4811)
2016/04/13 15:45:21 - write to [AFFICHE_COMMUNE].0 -    ... 6 more  

这个问题的根源可能是什么?

4

1 回答 1

2

解决方案是对正在映射到 SQL Server 中 datetime2 字段的字段使用 Timestamp 数据类型,因为 Date 被隐式转换为 datetime 字段。

要修改数据类型,在您的表格输入后,在“选择值”下有一个元数据选项卡,您可以在那里为您的输入字段设置数据类型。

稍后我会尝试获取屏幕截图。

于 2016-04-13T16:05:40.437 回答