kettle使用文件導(dǎo)入到Postgresql出現(xiàn)亂碼的解決方法-創(chuàng)新互聯(lián)

創(chuàng)新互聯(lián)www.cdcxhl.cn八線動態(tài)BGP香港云服務(wù)器提供商,新人活動買多久送多久,劃算不套路!

創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都做網(wǎng)站、成都網(wǎng)站建設(shè)、來賓網(wǎng)絡(luò)推廣、成都小程序開發(fā)、來賓網(wǎng)絡(luò)營銷、來賓企業(yè)策劃、來賓品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們大的嘉獎;創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供來賓建站搭建服務(wù),24小時服務(wù)熱線:18982081108,官方網(wǎng)址:muchs.cn

小編給大家分享一下kettle使用文件導(dǎo)入到Postgresql出現(xiàn)亂碼的解決方法,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!

kettle使用文件導(dǎo)入到Postgresql出現(xiàn)如下幾種問題的總結(jié):

第一種錯誤,報錯如ERROR:  extra data after last expected column所示?;蛘邎箦e為報錯為0x05,多一列,extra data after last expected column。

sql查詢語句定位到某個字段:

SELECT * ),'%')

解決方法,使用空替代,原因是出現(xiàn)特殊字符,),這種字符,導(dǎo)致的錯誤。

解決方法如下所示:

 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 * ),'%')

解決方法:是字段的值出現(xiàn)了,換行回車,),)。)多一行,少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;
 }

看完了這篇文章,相信你對kettle使用文件導(dǎo)入到Postgresql出現(xiàn)亂碼的解決方法有了一定的了解,想了解更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道,感謝各位的閱讀!

當(dāng)前題目:kettle使用文件導(dǎo)入到Postgresql出現(xiàn)亂碼的解決方法-創(chuàng)新互聯(lián)
URL鏈接:http://muchs.cn/article20/dejpco.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁設(shè)計(jì)公司網(wǎng)站維護(hù)、網(wǎng)站建設(shè)搜索引擎優(yōu)化、云服務(wù)器電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計(jì)公司