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

Stored procedure adapter and dates

  • 1.  Stored procedure adapter and dates

    Posted Thu February 13, 2003 03:25 PM

    I’m trying to call a PL/SQL procedure which takes a Date for input. I’ve failed to get passing dates into my adapter to work.

    I’ve used a map step with pub.date:getCurrentDate to get the current date as a java.util.Date. Passing this into the adapter resulted in a ClassCastException, so I changed the adapter input type from java.sql.Date to java.util.Date.

    This however results in an ORA-01008: Not all variables bound. The Oracle documentation states that this involves substitution variables, and the adapter shouldn’t be using those at all.

    Just to test, I modified the PL/SQL to not take in the date parameter but use sysdate instead. When there was no dates involved everything went fine. Unfortunately, the date is needed…

    Does anyone know what I might be doing wrong?


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


  • 2.  RE: Stored procedure adapter and dates

    Posted Thu February 13, 2003 03:43 PM

    Maybe using pub.date:currentDate would work. This gets the date as string, not a Java object. This service accepts a pattern for the date string. Use a pattern that is right for your Oracle instance.


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


  • 3.  RE: Stored procedure adapter and dates

    Posted Thu February 13, 2003 04:09 PM

    Hmm… As my organization has a bunch of Oracle databases, and I don’t think they all use the same date formats, that’s not necessarily the best option. It’s a workaround though.

    But I thought the adapter would HAVE to support date parameters, and that I’m using it the wrong way… Would the deprecated pub.db:call or pub.db:execSQL perhaps be better? I’ve not tried these, but I’ve seen there are a lot of posts about them.


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


  • 4.  RE: Stored procedure adapter and dates

    Posted Fri February 14, 2003 03:29 AM

    Oracle is very tricky on what dates it will accept and what format the date is in. The easiest way around this is to use the Oracle to_date function as part of the SQL call. For example the SQL Server query:

    Select * from table where dateField > ‘2/13/2003 15:12:00’

    In Oracle would be written

    Select * from table where dateField > to_date(‘2/13/2003 15:12:00’, ‘DD-Mon-YYYY hh24:mi:ss’)

    Hope this helps in some way.

    Thomas


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


  • 5.  RE: Stored procedure adapter and dates

    Posted Fri February 14, 2003 11:05 AM

    Actually I think that would be ‘dd/mm/yyyy’ and onwards… ‘dd-mon-yyyy’ expects dashes instead of slashes and textly month (like jan or feb).

    That’s what I’d be doing, programming in java. And I expected the adapter to do the same thing, but obviously it’s not. I unfortunately don’t have control over the SQL generated by the adapter. Sending a string to the adapter, I suspect it would put my TO_DATE inside 's and thus avoid the conversion inside the DBMS and fail.

    I can make the JDBC call in a java service created myself, if I only knew how to get the connection information stored. If I have a connection org.personell.conn:personell, how do I go about extracting this?


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


  • 6.  RE: Stored procedure adapter and dates

    Posted Mon February 17, 2003 04:46 PM

    I’ve tried all the different ways of putting dates in the adapter now, including putting java.sql.Date, java.util.Date, String into a Date input, and putting java.sql.Timestamp, java.util.Date, String into a Timestamp input, and String into a Varchar input. Nothing works.


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


  • 7.  RE: Stored procedure adapter and dates

    Posted Mon February 17, 2003 04:55 PM

    Hi, Brigt.

    Can we take a step back and look at the services you are using and what variables you are passing to the services?

    Use F7 to step through your Flow and keep an eye on the “Results” tab.

    Be sure to note if the Pipeline objects are object or String types.

    Thanks.


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


  • 8.  RE: Stored procedure adapter and dates

    Posted Tue February 18, 2003 10:34 AM

    The kinds of pipeline objects I’ve tried to pass are both kinds. The java.util.Date, java.sql.Date and java.sql.Timestamp are objects (and depicted with a nice watch picture in the results tab), while the string is, naturally, a string.

    The services I use are as follows:

    • pub.date:getCurrentDate - returns a java.util.Date. This will be replaced with a date input coming from a published document later.

    • util:utilDateToSqlDate - A very simple java service I made to convert java.util.Date to java.sql.Date.

    • util:utilDateToTimestamp - Ditto, to java.sql.Timestamp.

    • The stored procedure adapter I created, which takes in 5 varchar parameters and 1 date parameter. As mentioned in my previous post, I’ve changed the expected input type for the date parameter in the adapter as I’ve changed the objects I try to pass in.


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


  • 9.  RE: Stored procedure adapter and dates

    Posted Thu March 13, 2003 05:45 PM

    You might be interested in knowing webMethods has admitted the stored procedure adapter does not work with date input parameters.

    However, the Custom SQL adapter is a workaround, so creating java services for this purpose is unnecessary.


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


  • 10.  RE: Stored procedure adapter and dates

    Posted Tue January 11, 2005 01:58 AM

    Hey Brigt,

    I am also having issues with a web service which inturn calls a stored procedure written for SQL Server. This Stored Proc takes and returns date.
    Do you have a JAVA code handy for util:utilDateToSqlDate and util:utilDateToTimestamp which you wrote? Can you upload it here ?
    i wanna try something real quick 2morrow morning.

    Thanks !


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