kettle postgresql 乱码怎么解决
2023-04-18 14:24:56 时间
kettle使用文件导入到Postgresql出现如下几种问题的总结:
第一种错误,报错如ERROR: extra data after last expected column所示。或者报错为报错为0x05,多一列,extra data after last expected column。
sql查询语句定位到某个字段:
SELECT * ),'%')
解决方法,使用空替代,原因是出现特殊字符,),这种字符,导致的错误。
解决方法如下所示:
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { Object[] r = getRow(); if (r == null) { setOutputDone(); return false; } // It is always safest to call createOutputRow() to ensure that your output row’s Object[] is large // enough to handle any new fields you are creating in this step. r = createOutputRow(r, data.outputRowMeta.size()); String 字段名称 = get(Fields.In, "字段名称").getString(r); if(字段名称 != null) { 字段名称 = 字段名称.replaceAll(( + "", ""); } get(Fields.Out, "字段名称").setValue(r, 字段名称); // Send the row on to the next step. putRow(data.outputRowMeta, r); return true; }
第二种错误,报错如missing data for column "datastamp"。
sql查询语句定位到某个字段:
SELECT * ),'%')
或者
SELECT * ),'%')
解决方法:是字段的值出现了,换行回车,),)。)多一行,少n列,missing data column xxx。解决方法:使用字符替代,然后再替换回来。
解决方法如下所示:
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { Object[] r = getRow(); if (r == null) { setOutputDone(); return false; } // It is always safest to call createOutputRow() to ensure that your output row’s Object[] is large // enough to handle any new fields you are creating in this step. r = createOutputRow(r, data.outputRowMeta.size()); String 字段名称 = get(Fields.In, "字段名称").getString(r); if(字段名称 != null) { 字段名称 = 字段名称.replaceAll("\r", "@#r;"); 字段名称 = 字段名称.replaceAll("\n", "@#n;"); } get(Fields.Out, "字段名称").setValue(r, 字段名称); // Send the row on to the next step. putRow(data.outputRowMeta, r); return true; }
第三种错误,报错如,0x00的解决方法:
sql查询语句定位到某个字段:
SELECT * ),'%')
解决方法:
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { Object[] r = getRow(); if (r == null) { setOutputDone(); return false; } // It is always safest to call createOutputRow() to ensure that your output row’s Object[] is large // enough to handle any new fields you are creating in this step. r = createOutputRow(r, data.outputRowMeta.size()); // Get the value from an input field String 字段名称 = get(Fields.In, "字段名称").getString(r); if(字段名称 != null) { 字段名称= 字段名称.replaceAll("\u0000", ""); } get(Fields.Out, "字段名称").setValue(r, 字段名称); // Send the row on to the next step. putRow(data.outputRowMeta, r); return true; }
Python学习网,大量的免费PostgreSQL入门教程,欢迎在线学习!
相关文章
- Python使用tkinter组件Label显示简单数学公式
- 内网渗透之DCOM横向移动
- 以目标为导向的语义交流的共同语言——一个课程学习框架
- python爬虫前奏【成信笔记】
- HTML 5 File API:文件拖放上传功能
- 教你快速创建 Python 虚拟环境
- pyenv 实现Python多版本自由切换
- 用 Python 对 Excel文件进行批量操作
- Python - 接入钉钉机器人
- Python - 抓取 iphone13 pro 线下店供货信息并发送到钉钉机器人,最后设置为定时任务
- crontab - 解决 mac 下通过 crontab 设置了 Python 脚本的定时任务却无法运行
- [源码解析] PyTorch分布式(5) ------ DistributedDataParallel 总述&如何使用
- Python科普系列——类与方法(上篇)
- SAP对STO的交货单执行PGI,报错 -Fld selectn for mvmt type 643 acct 400020 differs
- Spring Boot 实现通用 Auth 认证的 4 种方式
- 盘点4种使用Python批量合并同一文件夹内所有子文件夹下的Excel文件内所有Sheet数据
- OushuDB 学习经验分享(三):技术特点
- Java和Python思维方式的不同之处
- Python中日志记录新技能
- 奥比中光Gemini OpenCV—Python使用