4

I'm trying to run a job which moves data from a set of tables in an Oracle connection to an Sql Server One. But I'm getting the following exception which causes the job stopping :

2017/04/04 11:00:56 - read from [DEMANDE].0 - ERROR (version 6.0.1.0-386, build 1 from 2015-12-03 11.37.25 by buildguy) : org.pentaho.di.core.exception.KettleDatabaseException: 
2017/04/04 11:00:56 - read from [DEMANDE].0 - Couldn't get row from result set
2017/04/04 11:00:56 - read from [DEMANDE].0 - 
2017/04/04 11:00:56 - read from [DEMANDE].0 - Unable to get value 'Integer(38)' from database resultset, index 3
2017/04/04 11:00:56 - read from [DEMANDE].0 - Overflow Exception
2017/04/04 11:00:56 - read from [DEMANDE].0 - 
2017/04/04 11:00:56 - read from [DEMANDE].0 - 
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at org.pentaho.di.core.database.Database.getRow(Database.java:2367)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at org.pentaho.di.core.database.Database.getRow(Database.java:2337)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at org.pentaho.di.trans.steps.tableinput.TableInput.processRow(TableInput.java:145)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at java.lang.Thread.run(Thread.java:744)
2017/04/04 11:00:56 - read from [DEMANDE].0 - Caused by: org.pentaho.di.core.exception.KettleDatabaseException: 
2017/04/04 11:00:56 - read from [DEMANDE].0 - Unable to get value 'Integer(38)' from database resultset, index 3
2017/04/04 11:00:56 - read from [DEMANDE].0 - Overflow Exception
2017/04/04 11:00:56 - read from [DEMANDE].0 - 
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at org.pentaho.di.core.row.value.ValueMetaBase.getValueFromResultSet(ValueMetaBase.java:4702)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at org.pentaho.di.core.database.BaseDatabaseMeta.getValueFromResultSet(BaseDatabaseMeta.java:2091)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at org.pentaho.di.core.database.DatabaseMeta.getValueFromResultSet(DatabaseMeta.java:2901)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at org.pentaho.di.core.database.Database.getRow(Database.java:2359)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   ... 4 more
2017/04/04 11:00:56 - read from [DEMANDE].0 - Caused by: java.sql.SQLException: Overflow Exception
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at oracle.sql.NUMBER.toLong(NUMBER.java:371)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at oracle.jdbc.dbaccess.DBConversion.NumberBytesToLong(DBConversion.java:2915)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4373)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
2017/04/04 11:00:56 - read from [DEMANDE].0 -   at org.pentaho.di.core.row.value.ValueMetaBase.getValueFromResultSet(ValueMetaBase.java:4660)

What the index 4 is pointing to is a column which has the type Number(38,0) in the oracle schema, the corresponding type for Sql Server table created by Pentaho is decimal(38,0).
The problem is that the very same job is running smoothly for other connections.
I'm using the classes12.jar as jdbc driver. I've tried using ojdbc6.jar (the one which is certified to work with jdk6, jdk7 and jdk8) but could not establish the connection to the database (Oracle 9i)

I've tried upgrading Pentaho Kettle to the latest stable release (Pentaho 7.0). But it's still giving the same problem.

What could be causing this problem ?

4

3 回答 3

0

你看过下面的MS链接吗?

https://docs.microsoft.com/en-us/sql/relational-databases/replication/non-sql/data-type-mapping-for-oracle-publishers

于 2017-04-07T16:47:25.400 回答
0

无法从数据库结果集中获取值 'Integer(38)',索引 3

2017/04/04 11:00:56 - 从 [DEMANDE].0 读取 - 溢出异常

第一次尝试: 您是否尝试过读取大整数中的值?在 Kettle 中,我大量使用它,但我只用 Postgresql 尝试过。

第二次尝试:您是否尝试将值(通过 SQL)转换为较小的整数?或者也可以转换为字符串,然后将其转换为数字

我知道第二种解决方案并不优雅,但有时​​它可以解决您的问题。

于 2017-04-13T16:51:50.130 回答
0

我认为您的问题是 Oracle Number(38,0) 不等于 SQL Server Decimal(38,0)。

来自 Oracle 文档:

以下数字可以存储在 NUMBER 列中:

• 1 x 10^-130 到 9.99...9 x 10^125 范围内的正数,最多 38 个有效数字

•负数从 -1 x 10^-130 到 9.99...99 x 10^125,最多 38 个有效数字

•零

• 正无穷和负无穷(仅通过从 Oracle 数据库第 5 版导入生成)

SQL Server 文档指出 Decimal(38,0):

具有固定精度和比例的数值数据类型。小数和数字是同义词,可以互换使用。

论据

decimal[ (p[ ,s] )] 和 numeric[ (p[ ,s] )] 固定精度和小数位数。使用最大精度时,有效值从 - 10^38 +1 到 10^38 - 1

所以 Oracle Numeric 最多可以存储 10^130,而 SQL Server Decimal 最多可以存储 10^38。因此溢出。

您可能想要使用 SQL Server 浮点数据类型,它可以存储高达 1.79E+308

于 2017-04-13T15:21:28.083 回答