当前位置:网站首页>db2中kettle报错 Field [XXX] is required and couldn‘t be found 解决方法
db2中kettle报错 Field [XXX] is required and couldn‘t be found 解决方法
2022-08-04 02:43:00 【追逐梦想永不停】
一、前言
有一个需求,要从db2的某个表抽取数据到mysql的某个表中。
准备用kettle实现,由于数据来源是db2,因此要先写db2的sql语句,样例如下:
select
user_name as name,
concat(modifydate, concat(' ',modifytime)) as last_modified_date
from myschema.mytable
然后,mysql里的目标表中,使用了:
<value>
<name>name</name>
<rename>name</rename>
<update>Y</update>
</value>
<value>
<name>last_modified_date</name>
<rename>last_modified_date</rename>
<update>Y</update>
</value>
结果,执行时报错:
Field [name] is required and couldn't be found
上面明明配置了as name
,但是还报错没有name,就很奇葩。
二、解决方法
1.点击kettle里的获取和更新字段
试了下,发现如果sql是上面样的,那么自动生成的字段如下:
<value>
<name>user_name</name>
<rename>user_name</rename>
<update>Y</update>
</value>
<value>
<name>last_modified_date</name>
<rename>last_modified_date</rename>
<update>Y</update>
</value>
也就是说,db2里的sql,写了个user_name as name
,但是没有生效。
这样也行,但是还是别扭,为什么as没有生效呢?
2.于是,修改sql为:
select
trim(user_name) as name,
concat(modifydate, concat(' ',modifytime)) as last_modified_date
from myschema.mytable
加了一个trim,终于,不报错了。
所以结论就是,kettle里写db2的sql时,如果只用as,是不会生效的;
必须加些处理方法,例如trim()。(虽然不知道为什么)
三、备注
1.如果使用kettle连接db2数据库时,报错没有驱动,就把db2jcc4-9.7.0.6.jar
放到\data-integration\lib下,重启kettle即可。(这个就是连接db2用的jar包)
2.kettle连接db2数据库,使用的sql中,使用limit没有生效:fetch first 10 rows only
,运行后还是会查全部数据,不确定是为什么。
边栏推荐
- C language -- ring buffer
- Small Turtle Compilation Notes
- 实例036:算素数
- Sfdp 超级表单开发平台 V6.0.5 正式发布
- [QNX Hypervisor 2.2用户手册]10.3 vdev gic
- pytorch applied to MNIST handwritten font recognition
- uni-app 从零开始-基础模版(一)
- ant-design的Select组件采用自定义后缀图标(suffixIcon属性)时,点击该自定义图标没有反应,不会展示下拉菜单的问题
- P3384 【模板】轻重链剖分/树链剖分
- Download install and create/run project for HBuilderX
猜你喜欢
Instance, 038: the sum of the diagonal matrix
【Playwright测试教程】5分钟上手
Web APIs BOM - operating browser: swiper plug-in
出海季,互联网出海锦囊之本地化
【指针内功修炼】深度剖析指针笔试题(三)
参加Oracle OCP和MySQL OCP考试的学员怎样在VUE预约考试
Why use Selenium for automated testing
cdh6.x 集成spark-sql
There are n steps in total, and you can go up to 1 or 2 steps each time. How many ways are there?
Brush esp8266-01 s firmware steps
随机推荐
MCU C language -> usage, and meaning
系统太多,多账号互通如何实现?
2022焊工(初级)上岗证题目模拟考试平台操作
架构实战营模块三作业
C# 构造函数业务场景测试项目
脚手架内容详解分析
第13章 网络安全漏洞防护技术原理与应用
C语言--环形缓存区
倒计时2天,“文化数字化战略新型基础设施暨文化艺术链生态建设发布会”启幕在即
Priority_queue element as a pointer, the overloaded operators
C程序编译和预定义详解
[Original] Start the XPS/OXPS reader that comes with Windows 10
Dong mingzhu live cold face away, when employees frequency low-level mistakes, no one can understand their products
How to read the resources files in the directory path?
说说数据治理中常见的20个问题
Development of Taurus. MVC WebAPI introductory tutorial 1: download environment configuration and operation framework (including series directory).
浏览器存储
How to drop all tables under database in MySQL
Sfdp 超级表单开发平台 V6.0.5 正式发布
小程序+新零售,玩转行业新玩法!