kettle中javascript步驟錯誤處理,kettlejavascript

來源:互聯網
上載者:User

kettle中javascript步驟錯誤處理,kettlejavascript

javascript步驟錯誤處理

 

       如果你熟悉kettle轉換的錯誤特性,你可能想知道在javascript步驟如何使用。支援錯誤機制的步驟使用者介面機制是相同的,在javascript步驟右擊,選擇“定義錯誤處理”啟用錯誤處理並配置。javascript代碼可以識別錯誤行,並將他們轉寄到配置的錯誤處理步驟,通過使用_step_對象的putError()方法,需要以下幾個參數:

1)    RowMetaInterface對象描述行結構

2)    當前的錯誤行

3)    在此行檢測的錯誤數

4)    錯誤描述字串(錯誤訊息)

5)    引起錯誤的欄位名稱(字串)

6)    錯誤碼(字串)

 

通常情況下,原始的,未經修改的輸入行被傳遞到錯誤處理步驟。因此,前兩個參數通常被指定為getInputRowMeta()和row。其他參數取決於你想怎麼具體描述所遇到的錯誤。javascript步驟定義錯誤處理配置可以配置那些欄位輸出到錯誤處理步驟。


這個轉換的例子首先產生隨機字串。為了說明目的,javascript步驟判斷前面產生的字元缺少字母'a'和'K'就報錯,每個缺少字母就產生一個錯誤。

javascript步驟包含以下代碼:


 

varshould_error_on_a= (value.indexOf("a") == -1)?1:0;varshould_error_on_k= (value.indexOf("k") == -1)?1:0;  try{      if(should_error_on_a== 1 && should_error_on_k == 1){        throw{            message:"Value must contain 'a' and 'k'",            nr_errors:2,            field:"value",            errcode:"ERR:003"        }    }    elseif(should_error_on_a== 1){        throw{            message:"Value must contain 'a'",            nr_errors:1,            field:"value",            errcode:"ERR:001"        }    }    elseif(should_error_on_k== 1){        throw{            message:"Value must contain 'k'",            nr_errors:1,            field:"value",            errcode:"ERR:002"        }    }    //continue normally, passing the row on to the next step    trans_Status= CONTINUE_TRANSFORMATION;  }catch(e){    //divert the current row to the error step and do not pass anything to thenext  step    _step_.putError(getInputRowMeta(),row, e.nr_errors, e.message, e.field, e.errcode);    trans_Status= SKIP_TRANSFORMATION;}


kettle 42 串連資料庫錯誤,幫忙,

應該是Mysql資料庫配置的問題吧,網上有對應的解放方法,如:
解決方案:
1。 改表法。可能是你的帳號不允許從遠程登陸,只能在localhost。這個時候只要在localhost的那台電腦,登入mysql後,更改 "mysql" 資料庫裡的 "user" 表裡的 "host" 項,從"localhost"改稱"%"
mysql -u root -pvmwaremysql>use mysql;mysql>update user set host = '%' where user = 'root';mysql>select host, user from user;
2. 授權法。例如,你想myuser使用mypassword從任何主機串連到mysql伺服器的話。
這個不是Kettle的問題。
 
kettle串連sql server2008報錯報不存在執行個體yss_pc,但是啟動SQL Server Management Studio存在執行個體yss_pc

錯誤說明是說你的連結資料庫時報錯啊~
連結驅動異常啊~
你最好是先檢查一下你的連結語句,在確認你的連結連接埠之類的,在看看資料驅動是否有問題啊
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.