水壶使用文件导入到Postgresql出现乱码的解决方法

  介绍

小编给大家分享一水壶下使用文件导入到Postgresql出现乱码的解决方法,希望大家阅读完这篇文章后大所收获、下面让我们一起去探讨吧!

<强>水壶使用文件导入到Postgresql出现如下几种问题的总结:

第一种错,误报错如错误:,额外的数据经过去年预期列所示。或者报错为报错为0 x05,多一列,去年预期后额外的数据列。

sql查询语句定位到某个字段:

SELECT *) & # 39; % & # 39;)

解决方法,使用空替代,原因是出现特殊字符,),这种字符,导致的错误。

解决方法如下所示:

,public  boolean  processRow (StepMetaInterface 重度,StepDataInterface  sdi), throws  KettleException  {   ,,,,对象[],r =, getRow ();   ,   ,,,,if  (r ==, null), {   ,,,,setOutputDone ();   ,,,,return 假;   ,,,,}   ,   ,,,,//,It  is  always  safest 用call  createOutputRow(),用ensure  that  your  output 行's 对象[],   ,,,,is 大   ,,,,//,enough 用handle  any  new  fields 你断开连接;creating 却;能够拷贝的一步。   ,,,,r =, createOutputRow (r, data.outputRowMeta.size ());   ,   ,,,,String 字段名称,=,得到(领域有着,,“字段名称“).getString (r);   ,,,,如果(字段名称,!=,null), {   ,,,,,,,,字段名称,=,字段名称.replaceAll ((, +“,,,,,);   ,,,,}   ,,,,得到(Fields.Out,,“字段名称“).setValue (r,,字段名称);   ,   ,,,,//,Send 从而row 提醒用,next 步骤。   ,,,,putRow (data.outputRowMeta,, r);   ,   ,,,,return 真实;   以前,}

第二种错,误报错如丢失的数据列“datastamp"。

sql查询语句定位到某个字段:

SELECT *) & # 39; % & # 39;)

或者

, SELECT *) & # 39; % & # 39;)

解决方法:是字段的值出现了,换行回车,)))。多一行,少n列,缺失的数据列xxx。解决方法:使用字符替代,然后再替换回来。

解决方法如下所示:

,public  boolean  processRow (StepMetaInterface 重度,StepDataInterface  sdi), throws  KettleException  {   ,,,,对象[],r =, getRow ();   ,   ,,,,if  (r ==, null), {   ,,,,setOutputDone ();   ,,,,return 假;   ,,,,}   ,   ,,,,//,It  is  always  safest 用call  createOutputRow(),用ensure  that  your  output 行's 对象[],   ,,,,is 大   ,,,,//,enough 用handle  any  new  fields 你断开连接;creating 却;能够拷贝的一步。   ,,,,r =, createOutputRow (r, data.outputRowMeta.size ());   ,   ,,,,String 字段名称,=,得到(领域有着,,“字段名称“).getString (r);   ,,,,如果(字段名称,!=,null), {   ,,,,,,,,字段名称,=,字段名称.replaceAll (“\ \ r",,“@ # r;“);   ,,,,,,,,字段名称,=,字段名称.replaceAll (“\ \ n",,“@ # n;“);   ,,,,}   ,,,,得到(Fields.Out,,“字段名称“).setValue (r,,字段名称),,,,,   ,   ,,,,//,Send 从而row 提醒用,next 步骤。   ,,,,putRow (data.outputRowMeta,, r);   ,   ,,,,return 真实;   以前,}

第三种错,误报错如,0 x00的解决方法:

sql查询语句定位到某个字段:

SELECT *) & # 39; % & # 39;)

解决方法:

,public  boolean  processRow (StepMetaInterface 重度,StepDataInterface  sdi), throws  KettleException  {   ,,,,对象[],r =, getRow ();   ,   ,,,,if  (r ==, null), {   ,,,,setOutputDone ();   ,,,,return 假;   ,,,,}   ,   ,,,,//,It  is  always  safest 用call  createOutputRow(),用ensure  that  your  output 行's 对象[],   ,,,,is 大   ,,,,//,enough 用handle  any  new  fields 你断开连接;creating 却;能够拷贝的一步。   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null

水壶使用文件导入到Postgresql出现乱码的解决方法