Talend(v5.2.0.r92826) 使用tJDBCOutput链接postgres数据...

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------
测试

相关文章
相关标签/搜索