• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

kettle postgresql 乱码怎么解决

mysql 搞java代码 3年前 (2022-05-21) 24次浏览 已收录 0个评论

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;
 }

www#gaodaima.com来源gao($daima.com搞@代@#码(网搞代码

第二种错误,报错如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;");
         字段名称 = 字段名称.replaceAll("
", "@#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入门教程,欢迎在线学习!

来源:搞代码网:原文地址:https://www.gaodaima.com


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:kettle postgresql 乱码怎么解决

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址