• Index
  •  » Talend Open Studio for Data Integration » Installation
  •  » using date with sybase

#1 2007-07-18 19:13:58

mouseman
Member
Registered: 2006-10-24
Posts: 42

using date with sybase

Tags: [datatime, sybase]

hello,

I'm trying to use Date from Sybase table.

When running i have the error :

[statistics] disconnected
Exception in component tSybaseInput_1
java.sql.SQLException: JZ009: L'erreur suivante a été détectée pendant la conversion : java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
    at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
    at com.sybase.jdbc3.jdbc.Convert.objectToTimestamp(Unknown Source)
    at com.sybase.jdbc3.jdbc.Convert.objectToDateObject(Unknown Source)
    at com.sybase.jdbc3.tds.TdsJdbcInputStream.getDateObject(Unknown Source)
    at com.sybase.jdbc3.jdbc.SybResultSet.getTimestamp(Unknown Source)
    at defi2_bis.alimentation_defi_001.Alimentation_Defi_001.tSybaseInput_1Process(Alimentation_Defi_001.java:2264)
    at defi2_bis.alimentation_defi_001.Alimentation_Defi_001.tSybaseInput_2Process(Alimentation_Defi_001.java:436)
    at defi2_bis.alimentation_defi_001.Alimentation_Defi_001.main(Alimentation_Defi_001.java:2441)

the code is :

                    if (rs_tSybaseInput_1.getTimestamp(4) != null) {
                        row5.DateDebutValidite = new java.util.Date(
                                rs_tSybaseInput_1.getTimestamp(4).getTime());
                    } else {
                        row5.DateDebutValidite = null;
                    }


this append on a lookup table ( row5 ), and ( for instance ) i don(t use the date column for any test..

is it a specific problem with SYBASE ?

How is possible to convert the data ?

thank you for your help.

Offline

#2 2007-07-18 19:29:19

cantoine
Talend team
Registered: 2006-09-19
Posts: 719
Website

Re: using date with sybase

Hi,

Do you need Nano seconds precision ?

Because you can modify your timestamp format : "yyyy-mm-dd hh:mm:ss"

Normally it works.

I'm trying some tests and i am searching a bug fix.   

Maybe this is a java bug.

Regards.

Offline

#3 2007-07-18 20:19:54

SybaseUnhappyUser
Guest

Re: using date with sybase

Sybase and MS SQL Server have a silly way to store date/time. The precision is... 3 milliseconds!

Just try running  "select getdate()" several times:
2007-07-18 19:44:48.330
2007-07-18 19:45:22.053
2007-07-18 19:45:27.880
2007-07-18 19:45:45.266
2007-07-18 19:45:52.236
...

You can notice that the timestamp always ends with 0, 3 or 6. Other values are illegal.

So the safe thing to do is to round up a date/time to 10 milliseconds, at least.

2007-07-18 19:45:52.237526   => illegal
2007-07-18 19:45:52.237        => illegal
2007-07-18 19:45:52.230        => OK
2007-07-18 19:45:52              => OK

#4 2007-07-20 11:21:41

mouseman
Member
Registered: 2006-10-24
Posts: 42

Re: using date with sybase

thank you.

Sometime the convert(datetime,xxx,103)  function is usefull to have a correct timestamp

Offline

#5 2010-11-09 04:51:51

dministrator
Member
Registered: 2010-06-24
Posts: 31

Re: using date with sybase

Sorry to revive an old thread...but I'm facing the same issue.

I tried using CONVERT like Mouseman suggested in my MSSQLInput's SELECT Query, as well as cantoine's suggestion with removing microseconds. It isn't working.

Please someone help.

I'm using Talend Data Quality version:  4.0.1
Build id: r41260-20100427-0748
JDK and JRE 1.6. Release 22

Thank you.

Offline

#6 2010-11-09 08:15:47

shong
Talend team
Registered: 2007-08-29
Posts: 10354
Website

Re: using date with sybase

Hello dministrator
Please describe your question with more info, what's the error message do you get? What's the data type?

Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#7 2010-11-09 19:48:22

dministrator
Member
Registered: 2010-06-24
Posts: 31

Re: using date with sybase

Thank you Shong.

My data type in Talend Schema is Date. The corresponding column in MS SQL Server query is of DateTime type.

The exception I get is this like that of OP:

java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff

Since my goal is a CSV file, for now, I'm managing it by changing the schema's data type as String.

My job is very simple - the components I use are, a single tMSSQLInput with a SELECT query (without any joins) and it's output connected to tLogRow.

Offline

#8 2011-04-07 05:22:36

cypher
New member
Company: AATi
Registered: 2011-04-07
Posts: 4

Re: using date with sybase

Hi,

I'm facing the same issue with talend Date type saying that :

java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]

But when I put the said pattern i'm still getting the same exception

I'm using the tOracleInput component and connect to a tMap component.

My talend schema is Date and the corresponding column in Oracle is TIMESTAMP.

The job is pretty much simple, Select all valid record in table_1 then insert the current records onto table_1_history then update the current record STAT_CODE and TIMESTAMP column and save it to a CSV file.

TIS version : 4.1.2 r 53616
OS : Win XP SP3
Java Version : 1.6.0_22

Offline

#9 2011-04-07 05:52:22

shong
Talend team
Registered: 2007-08-29
Posts: 10354
Website

Re: using date with sybase

Hi cypher
What's data looks like in table?

Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#10 2011-04-07 06:21:25

cypher
New member
Company: AATi
Registered: 2011-04-07
Posts: 4

Re: using date with sybase

Hi Shong,

Thanks for the reply.

Here's some of the record that's need to be updated.

Column Definition:
ACTVTY_CD (Varchar : PK),
ENDT_EFF_DT (Timestamp: PK),
REF_GROUP_CD (Varchar : PK),
STAT_CD (Varchar),
TIMESTAMP (Timestamp)

Record(s):
ACT00152    2011-03-16 12:42:03.065    001000    P    2011-03-16 12:42:03.065
ACT00153    2011-03-16 12:42:03.081    001000    P    2011-03-16 12:42:03.081
ACT00160    2011-02-24 17:11:20.463    001000    P    2011-02-24 17:11:20.525

Only the TIMESTAMP  column throws an error.

Last edited by cypher (2011-04-07 06:22:23)

Offline

#11 2011-04-08 08:07:16

shong
Talend team
Registered: 2007-08-29
Posts: 10354
Website

Re: using date with sybase

Hi cypher

How do you set the data pattern when you set the DB type as timestamp? "yyyy-MM-dd HH:mm:ss.SSS"? To work around it, you can read it as a string, and then parse the string to a Date on tMap, for example: TalendDate.parseDate("yyyy-MM-dd HH:mm:ss.SSS", row1.TIMESTAMP)

Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#12 2011-04-08 11:07:15

cypher
New member
Company: AATi
Registered: 2011-04-07
Posts: 4

Re: using date with sybase

Hi Shong,

I think we didn't set any date pattern when inserting to database.

I'll try the workaround you suggest and hopefully will work.

Thanks a lot shong,

Offline

#13 2011-04-08 11:20:32

shong
Talend team
Registered: 2007-08-29
Posts: 10354
Website

Re: using date with sybase

Hi

Can you show us the the whole error message? on which component does the error occur? You said you use tOracleInput in previous post.

Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#14 2011-04-08 11:28:34

cypher
New member
Company: AATi
Registered: 2011-04-07
Posts: 4

Re: using date with sybase

Here the error message:

Exception in component tOracleInput_1
java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
    at java.sql.Timestamp.valueOf(Unknown Source)
    at oracle.jdbc.driver.CharCommonAccessor.getTimestamp(CharCommonAccessor.java:486)
    at oracle.jdbc.driver.T4CVarcharAccessor.getTimestamp(T4CVarcharAccessor.java:897)
    at oracle.jdbc.driver.OracleResultSetImpl.getTimestamp(OracleResultSetImpl.java:1060)
    at clpgas_talend.preprocessactivityclosing_0_1.preProcessActivityClosing.tOracleInput_1Process(preProcessActivityClosing.java:2683)
    at clpgas_talend.preprocessactivityclosing_0_1.preProcessActivityClosing.tOracleConnection_1Process(preProcessActivityClosing.java:807)
    at clpgas_talend.preprocessactivityclosing_0_1.preProcessActivityClosing.tJava_1Process(preProcessActivityClosing.java:691)
    at clpgas_talend.preprocessactivityclosing_0_1.preProcessActivityClosing.runJobInTOS(preProcessActivityClosing.java:4906)
    at clpgas_talend.preprocessactivityclosing_0_1.preProcessActivityClosing.runJob(preProcessActivityClosing.java:4601)
    at clpgas_talend.activityclosing_0_1.activityClosing.tRunJob_5Process(activityClosing.java:4324)
    at clpgas_talend.activityclosing_0_1.activityClosing.tJava_2Process(activityClosing.java:4130)
    at clpgas_talend.activityclosing_0_1.activityClosing.tOracleConnection_1Process(activityClosing.java:6035)
    at clpgas_talend.activityclosing_0_1.activityClosing.runJobInTOS(activityClosing.java:6541)
    at clpgas_talend.activityclosing_0_1.activityClosing.main(activityClosing.java:6089)
Exception in component tRunJob_5


Here's my schema definition:

ACTVTY_CD (varchar : PK)
ENDT_EFF_DT (timestamp : PK)
REF_GROUP_CD (varchar : PK)
STAT_CD (varchar)
TIMESTAMP (timestamp)
DYNAMIC_FIELD (dynamic)

Sample Query : SELECT * FROM TABLE_1;

Offline

#15 2011-06-26 18:22:22

sara_marouan
Guest

Re: using date with sybase

hii
when running i have this error

Démarrage du job chaine_logistique a 17:09 26/06/2011.

[statistics] connecting to socket on port 3792
[statistics] connected
Exception in component tMap_1
java.lang.NullPointerException
    at bi.chaine_logistique_0_1.chaine_logistique.tAccessInput_7Process(chaine_logistique.java:3884)
    at bi.chaine_logistique_0_1.chaine_logistique.runJobInTOS(chaine_logistique.java:6541)
    at bi.chaine_logistique_0_1.chaine_logistique.main(chaine_logistique.java:6412)
[statistics] disconnected
Job chaine_logistique terminé à 17:09 26/06/2011. [Code sortie=1]

plzz help

#16 2012-03-01 07:59:51

Manabi
Guest

Re: using date with sybase

Did you get the solution? I am facing the same issue.

#17 2012-12-10 12:50:27

lisajackusde
Member
Registered: 2012-12-10
Posts: 10

Re: using date with sybase

deletepostspam

Last edited by lisajackusde (2012-12-10 13:11:15)

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Installation
  •  » using date with sybase

Board footer

Powered by FluxBB