I am trying to import data from HDFS to postgres using springxd's hdfsjdbc job This is my job definition
job create ss1_cities_hdfsjdbc --definition "hdfsjdbc -- resources=/springXD/cities/*.csv --driverClassName=org.postgresql.Driver -- url=jdbc:postgresql://postgresDB:5432/postgres --useame=admin --password=admin --names=id,city,country,last_updated --tableName=cities " --deploy
Postgres table definition:
CREATE TABLE cities_date (id integer,country varchar(150),city varchar(150), last_Updated timestamp);
Error while tranfering :
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [insert into cities_date(id, city, country, last_Updated) values (?, ?, ?, ?)]; nested exception is org.postgresql.util.PSQLException: ERROR: column "id" is of type integer but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
Position: 25
When i make all column's datatype as varchar it works fine.
I think this is possible in sqoop ref : http://www.tutorialspoint.com/sqoop/sqoop_export.htm.
