Talend支持多種數據庫,其組件中除了有相應數據庫的鏈接組件以外,還有一組tJDBC鏈接組件用於可經過手工指定jdbc鏈接參數鏈接各類數據源的方案,使用tJDBC組件方便於在不一樣環境下使用不一樣數據庫種類時不用修改job。 php
我測試了使用tJDBCOutput鏈接postgresql時好像有個bug,就是其生成的INSERT語句中的表名和字段名沒有加上雙引號,例如: sql
String insert_tJDBCOutput_1 = "INSERT INTO " + "tab_card_info" + " (src_file_name,Card_No) VALUES (?,?)"; 數據庫
這會致使運行時出錯,由於postgresql要求sql語句中表名和字段名加上雙引號。 app
而若是直接使用tPostgresqlOutput,則生成的正確語句以下: less
String insert_tPostgresqlOutput_1 = "INSERT INTO \"" + "tab_card_info" + "\" (\"src_file_name\",\"Card_No\") VALUES (?,?)";
期待talend儘快修正這個bug後 post
附,postgresql的特殊要求:
If your object (table, column, view etc) have mixed-case names (e.g.
My_Table instead of my_table), you need to quote them. If you have a table
called My_Table but use [SELECT * FROM My_Table;] it won't match as it is
treated as if it is all lower-case unless you quote it. In that case, you'd
have to use [SELECT * FROM "My_Table";]. The same applies to any database
object.
------http://archives.postgresql.org/pgsql-novice/2009-10/msg00032.php------
測試