
Contributor
2013-06-20
07:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
put the current date into a postgresql timestamp column
Hi,
I'm new with talend and can't find a solution for the following simple problem:
I want to write the current date to a postgressql column with type "timestamp without timezone" using the components tMap and tPostgreSQL.
I tried TalendDate.getDate("CCYY-MM-DD hh:mm:ss") the talend format is Date with dateformat "yyyy-MM-dd' 'HH:mm:ss"
If I try to run the job it complains Talend can't convert String to Date
If I change Date to String, the job starts but cannot write the data to the database I get the errormessage "ERROR: column »datum_anlage« has type timestamp without time zone, but the expression has Typ character.
Has anybody an idea how to solve this problem?
Thanks!
anna.talend
I'm new with talend and can't find a solution for the following simple problem:
I want to write the current date to a postgressql column with type "timestamp without timezone" using the components tMap and tPostgreSQL.
I tried TalendDate.getDate("CCYY-MM-DD hh:mm:ss") the talend format is Date with dateformat "yyyy-MM-dd' 'HH:mm:ss"
If I try to run the job it complains Talend can't convert String to Date
If I change Date to String, the job starts but cannot write the data to the database I get the errormessage "ERROR: column »datum_anlage« has type timestamp without time zone, but the expression has Typ character.
Has anybody an idea how to solve this problem?
Thanks!
anna.talend
595 Views
3 Replies

Anonymous
Not applicable
2013-06-20
11:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Open Studio doesn't shield you from the underlying Java language very much at all. Java is strongly typed, and you'll come across this type of thing again and again as you get familiar with Talend.
So, since what you're writing to is a Date, you have to send a java Date object. And the schema has to be set to Date. You can create a java date with the java expression "new Date()", or if that doesn't work "new java.util.Date()". That will be the current time.
So, instead of "TalendDate.getDate()", try "new java.util.Date()" and let us know if that gives a different error message (sorry it's not convenient for me to create a new job and table to test it out but I think that'll work).
Levin
So, since what you're writing to is a Date, you have to send a java Date object. And the schema has to be set to Date. You can create a java date with the java expression "new Date()", or if that doesn't work "new java.util.Date()". That will be the current time.
So, instead of "TalendDate.getDate()", try "new java.util.Date()" and let us know if that gives a different error message (sorry it's not convenient for me to create a new job and table to test it out but I think that'll work).
Levin
595 Views

Contributor
2013-06-21
04:55 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Levin,
thanks, a lot!
I tried java.util.Date and java.sql.Timestamp both works.
anna.talend
thanks, a lot!
I tried java.util.Date and java.sql.Timestamp both works.
anna.talend
595 Views

Creator II
2016-11-03
05:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The question is very old,but when am trying to do the same am unable to get the out put
am using tmap and tmysql output
and only one column date and in tmap date column expression i am using "new java.util.Date()".but it is not displaying nor inserting date column into table
tmap---->tmysqloutput
regards,
rekha
The question is very old,but when am trying to do the same am unable to get the out put
am using tmap and tmysql output
and only one column date and in tmap date column expression i am using "new java.util.Date()".but it is not displaying nor inserting date column into table
tmap---->tmysqloutput
regards,
rekha
595 Views
