IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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

How to pass a Date object to JDBC adapter without changing the format of the date.

  • 1.  How to pass a Date object to JDBC adapter without changing the format of the date.

    Posted Fri August 17, 2012 02:04 PM

    Hello Team,

    I am actually facing an issue to pass a java date object to my JDBC adapter service.

    I have a date string as such 2012/08/17 11:08:02.102 AM. When I conver it to a java date object I am getting the below 2012/08/17 11:08:02 CAT using the method wm.tn.util:stringToDate. I would like my date object to be the same format as the date string when passing it to the jdbc adapter service.

    Does anyone knows how to do this or can just help me on that?

    Thanking you in advance.

    Kind Regards,
    kolo


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: How to pass a Date object to JDBC adapter without changing the format of the date.

    Posted Fri August 17, 2012 03:42 PM

    When you see "2012/08/17 11:08:02 CAT", it’s just a readable view of the java.util.Date object. As an object, it has to be re-format (basically a conversion into a String with a default pattern) in a way you can understand it.

    Assuming you try to insert a java Date into a DATE-type column, you just have to set the input of your jdbc adapter service to “java.util.Date” and map your object.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 3.  RE: How to pass a Date object to JDBC adapter without changing the format of the date.

    Posted Fri August 17, 2012 04:07 PM

    Hello Arnaud,

    Thanks for your reply. I have tested this also but the value written to the database is the only the date with a fixed time like 2012/08/17 12:00:00 AM.

    All my records are written to the table with the same time value. Please see attached image, my dateString after I convert it to date object. I can see in the pipeline the value of the date object which I will pass to my JDBC adapter is as such "2012/08/17 11:08:02 CAT" as the date is being written but the time is default 12:00:00 AM.

    Do you know how can I fixed this?

    Thanking you in advance.

    Kind Regards,
    kolo
    date.jpg


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 4.  RE: How to pass a Date object to JDBC adapter without changing the format of the date.

    Posted Fri August 17, 2012 04:45 PM

    Do a search for SQL date data type to find information. Basically, a SQL date does not have a time component–and the Oracle JDBC driver is more or less enforcing this.

    The wM and Oracle docs will describe the variety of things you can do to store the time portion.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB