webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

[SOLVED] SAP to Oracle Date - java.lang.String cannot be cast to java.util.Date -

  • 1.  [SOLVED] SAP to Oracle Date - java.lang.String cannot be cast to java.util.Date -

    Posted Wed September 16, 2020 01:59 PM

    Hello Everyone.

    I created a flow service that receives data from a SAP notification and this data must be inserted in an Oracle table.

    This table contains a column that is using the DATE data type.

    But, I didn’t figure out how can I insert the SAP date format ‘yyyy-mm-dd’ into this oracle table. It always gives me the following error:

    Error: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date

    I tried the pub.date:dateTimeFormat to format the date as “dd/MMM/yy” but it gives me the same issue.

    Please, what should I do to be able to insert the SAP Date format (yyyy-mm-dd as String) into an oracle table (as java.util.Date in my adapter service).

    Thank you


    #Integration-Server-and-ESB
    #Adapters-and-E-Standards
    #webMethods


  • 2.  RE: [SOLVED] SAP to Oracle Date - java.lang.String cannot be cast to java.util.Date -

    Posted Wed September 16, 2020 04:47 PM

    Hi Renan,

    Did you try by changing the Input Field Type as - java.lang.String from the drop-down in the adapter service?

    That way you should be able to pass the string input formatted whatever date format you want and pass it on to the adapter service.

    Regards,
    Firoz N


    #Adapters-and-E-Standards
    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: [SOLVED] SAP to Oracle Date - java.lang.String cannot be cast to java.util.Date -

    Posted Thu September 17, 2020 12:15 PM

    Hello @Firoz

    I managed to solve the issue.

    I followed your suggestion, but it didn’t work in the first time.

    But, I added TO_DATE(?, ‘yyyy-mm-dd’) in the expression of the DATE column and it worked!

    Thank you Firoz


    #Adapters-and-E-Standards
    #webMethods
    #Integration-Server-and-ESB