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

problem with batch insert jdbc adapter on Date columns

  • 1.  problem with batch insert jdbc adapter on Date columns

    Posted Tue June 13, 2006 07:56 AM

    hello, all
    There is a problem when insert the Date type columns in oracle. I am using BatchInsert adapter service. When the column type is Date, i write to_char(?,‘yyyymmdd’) in the expression column and set the input data type to string, but it doesn’t work. Each time i got this error:
    com.wm.app.b2b.server.ServiceException: [ART.117.4002] Adapter Runtime (Adapter Service): Unable to invoke adapter service lywConvertProc.importProc.Db:testInsert.
    [ADA.1.314] Cannot set data for the input field “IISM_ETA”
    Does anyone know how to solve this problem?
    Thanks
    nancy

    PS:manager, this content was firstly posted in JMS section by mistake. Could you please help to delete that? thanks.


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


  • 2.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Tue June 13, 2006 05:08 PM

    Is the format string you’re using correct for your database? I think Oracle wants yyyy-mm-dd.


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


  • 3.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Wed June 14, 2006 04:09 PM

    Nancy,

    I believe you’re using the wrong function. If you have a string and you want to insert it as a date, then you need the to_date function (not to_char). As Rob mentioned, however, Oracle allows you to insert a date as a string as long as you use their default format, which from what I remember is dd-MMM-yy (ex. 14-JUN-06)

    • Percio

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


  • 4.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Thu June 15, 2006 02:39 PM

    Hi Nancy,
    I had the same problem while inserting date field defined as string. Once i define to_date function it worked fine, so should be case with you.
    Cheers,
    KK


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


  • 5.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Thu June 15, 2006 03:36 PM

    Yes indeed it should work with to_date. let us know how it went.


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


  • 6.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Thu June 15, 2006 04:29 PM

    Nancy,

    Yet another possibility that you may want to consider is to:

    1. Change the “Input Field Type” of your DATE column from java.lang.String to java.util.Date in the adapter service
    2. Convert your date string to a java.util.Date object prior to invoking the adapter service

    With this approach, you would not have to worry about calling the to_date function. The advantage here is that if you ever decided to move to a database that did NOT support the to_date function, you shouldn’t have to change your adapter service.

    I thought for sure there was a WmPublic/pub.date service that provided this functionality (ie. convert a date string into a Date object given a certain pattern.) However, it doesn’t look like this service exists. Nevertheless, you could still easily create a Java service to accomplish this task by using the SimpleDateFormat class, for example. If you need further help, let me know.

    • Percio

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


  • 7.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Thu June 15, 2006 04:43 PM

    Hi Nancy,
    IMO, I will use java only if I cannot do something in FLOW easily.

    You can use the service pub.date:dateTimeFormat to format your date string in the format supported by your DB. This way you can keep the “Input Field Type” of your DATE column as java.lang.String and don’t have to use to_date or other conversion function supported by DB.

    HTH,
    Bhawesh.


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


  • 8.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Thu June 15, 2006 04:58 PM

    Bhawesh,

    Agreed. The problem that I’ve come across, however, is that sometimes the default format accepted by the DB only allows for month, day, and year. Therefore, if the requirement is also for the time (hours, minutes, etc.) to be inserted as part of the date, then another route must be taken.

    • Percio

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


  • 9.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Thu June 15, 2006 05:05 PM

    Hi Percio,
    The output of the service pub.date:dateTimeFormat is based on the pattern one supply and so it could be dd or MM or yyyy or HH or mm or ss or any combination of these. So if the DB only allows for month, day, and year, one will only supply these things as your desired output pattern e.g. dd-MMM-yyyy or whatever…

    Regards,
    Bhawesh


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


  • 10.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Fri June 16, 2006 05:14 PM

    Bhawesh,

    You misunderstood what I said. Let me try to be clearer.

    In Oracle, the default format for DATE is DD-MON-YY, right? Therefore, if I want to insert a date into Oracle but I also want to specify the time (HH24:MI:SS, for example), I cannot simply use the default format to insert the date as a string because, as you can see, time is not part of the default format.

    Without changing the database’s default, one could still insert the time along with the date by using the to_date function. My last suggestion was just an alternative to using the to_date function, just in case Nancy was looking for one.

    Thanks,
    Percio


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


  • 11.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Tue August 14, 2007 10:08 AM

    Hello all! I have problems inserting date with batchinsert in oracle database. I use java.util.Date class in batchinsert. The problem is that i cannot see time but only date. I changed the oracle’s default format with alter session command but still doesn’t work. Can anyone suggest something? Thank you in advance.


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


  • 12.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Tue August 14, 2007 01:34 PM


  • 13.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Tue August 14, 2007 02:01 PM

    I tried with java.sql.Date. First I tried in batchinsert with java.sql.date and it didn’t help. Next I tried with the service which converts a string into object but problem was that the returned object is always null ( I don’t know why ). So where to use java.sql.Date?


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


  • 14.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Tue August 14, 2007 04:09 PM

    My mistake. I’m only half remembering the solution for this from while back. What is the data type of the column? Depending on DB driver version and IS fixes, you may or may not be able to use the timestamp data type within the JDBC adapter service. If you cannot select timestamp within the service, you may need to apply a JDBC fix and apply a setting to the connection config to get that to happen. I don’t remember the details exactly but there is info on Advantage.


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


  • 15.  RE: problem with batch insert jdbc adapter on Date columns

    Posted Tue August 14, 2007 07:47 PM

    Thank you for your replies. There are three columns - first one is timestamp and others are dates. I looked in advantage but still I can’t find anything which can help. I can select timestamp within the service ( for the field ) ( I use version 6.1 of integration server ).


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