Stored Procedure in sender JDBC

Hey all,
I am trying to call a stored procudure in my sender JDBC adapter to send to an Idoc adapter. In the query statement, do I need to give just EXECUTE <stored proc name> or do I need to set up any special setting in the sender adapter?
-Teresa

Teresa,
Which DB are you trying to access?
If it is an oracle DB, then unfortunately, Sender JDBC adapter does not support stored procedures for an Oracle DB.
Reason is that JDBC adapter  expects a RESULTSET while Oracle Stored Procedure returns a Cursor.
For any other DB, EXECUTE <STOREDPROCNAME> will suffice.
Regards,
Bhavesh

Similar Messages

  • Error while executing the stored procedure through sender JDBC adapter

    Hi All,
    I am getting below error while executing the stored procedure through sender JDBC adapter.
    Database-level error reported by JDBC driver while executing statement 'exec SapgetNextEntity 'SalesOrder''. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
    what is the problem? any idea to anyone...
    regards
    Ramesh

    hi Dharamveer,
    I am not getting below statement for your reply
    Try to use Refrence Cursor it will return u reference of resultset.
    I mention SP like this
    exec SapgetNextEntity 'SalesOrder'
    SapgetNextEntity -
    > SP Name
    SalesOrder----
    > Parameter I am passing...
    regards
    Ramesh

  • Error in calling stored procedure in sender JDBC adapter

    Hi Experts,
    I am working on MySQl to SAP scenario. I have to use stored procedure in sender JDBC adapter.
    I am calling SP as fallows: execute proc_dtdc_booking_interface_sd
    But it returned following error,
    Database-level error reported by JDBC driver while executing statement 'execute proc_dtdc_booking_interface_sd'. The JDBC driver returned the following error message: 'java.sql.SQLException: Unknown prepared statement handler (proc_dtdc_booking_interface_sd) given to EXECUTE'. For details, contact your database server vendor.
    the way i called SP is correct ??
    please suggest me how to resolve the issue ??
    Regards,
    Bhuvan.

    Hi
    Below is the code , when we are using this code directly in the mySQl command promp, it fetches 10 record but when the same code is called through XI adapter  its fetching only one record
    DELIMITER $$
    DROP PROCEDURE IF EXISTS `proc_dtdc_booking_interface_sd` $$
    CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_dtdc_booking_interface_sd`()
    BEGIN
    declare done int(1);
    declare v_dsr_booked_by char(1) ;
    declare v_dsr_branch_code char(3) ;
    declare v_dsr_cust_code varchar(7) ;
    declare v_dsr_booking_date date ;
    declare v_dsr_cnno char(9) ;
    declare v_dsr_cn_type char(3) ;
    declare v_dsr_cn_weight decimal(8,3) ;
    declare v_dsr_dest char(3) ;
    declare v_dsr_mode char(2) ;
    declare v_dsr_amt decimal(10,2) ;
    declare v_dsr_dox char(1) ;
    declare v_office_code char(3) ;
    declare v_dsr_status char(1) ;
    declare v_dsr_remarks varchar(25) ;
    declare v_dsr_refno varchar(20) ;
    declare v_dsr_transmf_no varchar(10) ;
    declare v_dsr_trans_status_xi char(1) ;
    declare v_ndsr_cnno char(9) ;
    declare v_ndsr_product char(3) ;
    declare v_ndsr_sercharge decimal(8,3) ;
    declare v_ndsr_ins_amt decimal(8,3) ;
    declare v_ndsr_others decimal(8,3) ;
    declare v_dr_amt_type decimal(2,0) ;
    declare v_dr_extra_amt decimal(10,2) ;
    declare v_sales_document varchar(2) ;
    declare bookcur CURSOR for
    SELECT *
    FROM dtdcdb_rw.dtdc_booking_interface_sd
    LIMIT 10;
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET DONE=1;
    set done=0;
    OPEN bookcur;
    bookloop: loop
    FETCH bookcur
    INTO
    v_dsr_booked_by ,
    v_dsr_branch_code,
    v_dsr_cust_code,
    v_dsr_booking_date,
    v_dsr_cnno,
    v_dsr_cn_type,
    v_dsr_cn_weight,
    v_dsr_dest,
    v_dsr_mode,
    v_dsr_amt,
    v_dsr_dox,
    v_office_code,
    v_dsr_status,
    v_dsr_remarks,
    v_dsr_refno,
    v_dsr_transmf_no,
    v_dsr_trans_status_xi,
    v_ndsr_cnno,
    v_ndsr_product,
    v_ndsr_sercharge,
    v_ndsr_ins_amt,
    v_ndsr_others,
    v_dr_amt_type,
    v_dr_extra_amt,
    v_sales_document ;
    IF DONE=1 THEN
    LEAVE bookloop;
    END IF;
    select
    v_dsr_booked_by As dsr_booked_by,
    v_dsr_branch_code As dsr_branch_code,
    v_dsr_cust_code As dsr_cust_code,
    v_dsr_booking_date As dsr_booking_date,
    v_dsr_cnno As dsr_cnno,
    v_dsr_cn_type As dsr_cn_type,
    v_dsr_cn_weight As dsr_cn_weight,
    v_dsr_dest As dsr_dest,
    v_dsr_mode As dsr_mode,
    v_dsr_amt As dsr_amt,
    v_dsr_dox As dsr_dox,
    v_office_code As office_code,
    v_dsr_status As dsr_status,
    v_dsr_remarks As dsr_remarks,
    v_dsr_refno As dsr_refno,
    v_dsr_transmf_no As dsr_transmf_no,
    v_dsr_trans_status_xi As dsr_trans_status_xi,
    v_ndsr_cnno As ndsr_cnno,
    v_ndsr_product As ndsr_product,
    v_ndsr_sercharge As ndsr_sercharge,
    v_ndsr_ins_amt As ndsr_ins_amt,
    v_ndsr_others As ndsr_others,
    v_dr_amt_type As dr_amt_type,
    v_dr_extra_amt As dr_extra_amt,
    v_sales_document As sales_document;
    update dtdcdb_rw.dsr_table
    set dsr_trans_status_xi='T'
    where dsr_cnno=v_dsr_cnno;
    end loop;
    SELECT *
    FROM dtdcdb_rw.dtdc_booking_interface_sd
    LIMIT 10;
    END $$
    DELIMITER ;
    Please help
    Regards
    Bhuvan

  • Parameters to stored procedure from sender JDBC

    Hi,
    I am using the JDBC sender adapter to call the Oracle stored procedure. Oracle version is 10.2. hence I m using function call using select.
    My concern is, how to pass the input parameter to Oracle function from JDBC sender.
    Regards,
    Kavita

    Hi Kavita,
    <i>I am using the JDBC sender adapter to call the Oracle stored procedure</i>
    <i>Unfortunately, the sender JDBC adapter does not support Oracle's stored procedure/function. Unlike stored procedures from other database vendors, Oracle returns a cursor, not a resultset. The sender JDBC adapter must send a resultset to XI.</i>
    Executing an Oracle Stored Procedure from Sender JDBC adapter
    [Not sure about latest versions of Oracle]
    <i>can I pass the input parameter to this function? </i>
    In my opinion, No
    <i>If not, I need to change the approach, and need to use receiver JDBC[as need to pass input parameter]. </i>
    This could be possible but havent tried it
    <i>Can JDBC Receiver adapter support stored procedure for Oracle[10.2]</i>
    Yes
    Regards,
    Prateek

  • How to use Stored Procedures in Sender JDBC Adapter.

    Hi Experts,
        we are having a lot of legacy application which are on .Net. basicaly using MS SQL & stuff. As a Integration scenario we have to triggered some events from JDBC to XI. How can i do this. Secondly there are multiple tables from which i will be selecting a record & sending it to XI for further processing the Receiver Side we are having SAP system.
        How can i use a Stored procedure in XI Sender Adapter ?
        Can anybody tell me step by step how to get the XSD of Stored procudere & used in XI. ?
         I am new to XI. I have not yet configured any sceneario.
         Can anybody guide me step by step how to do this.
         I am only intersted in Sender Side configuration.
    Regards,
    Umesh

    Hey,
    check this in the JDBC Sender Adapter Configuration
    Query SQL Statement -> Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
    The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs.
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
    JDBC adapter
    /people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter
    <b>Cheers,
    *RAJ*
    *REWARD POINTS IF FOUND USEFULL*</b>

  • Stored procedure in Sender JDBC Adapter

    Hi All,
    My Scenrio goes like this ...
    Stored Procedure(SQL Server) --- PI  -
    File
    I need to write the results of  stored procedure to File.Here I don't need any mapping.So how many DT , MT and MI need to be created?
    The interface need to run by 6AM from Monday to Thrusday, how can i achieve this ?
    Stored Procedure has only select statement and no Update statement , but it takes Date as Input parameter , so what i need to provide in sender JDBC adapter.
    Thanks,
    Monish

    Hi Monish,
    As per your requirement it is JDBC to File. Please be careful with the structure to be created for sender JDBC. I am unable to understand why you donot require a mapping for this. How XI will send the data to a file then.As per my knowledge if it's file to file and just pick and drop then we can neglect IR and go for ID.But here you are working with JDBC and File so you will be in need of it.
    IR:
    DT: 2
    JDBC_Sender_DT
    File_Output_DT(Optional)
    You can use the JDBC sender data type structure for File output also.
    MT as per your DT
    MI:2
    Outbound MI: JDBC structure
    Inbound MI : File structure
    MM: 1
    IM: 1
    ID as similar to other scenarios.All 1 objects for RD,ID,Sender Agreement and Receiver Agreement.
    Sender JDBC channel:
    Query: Select * from table where date
    But I have a query how are you providing date in input paramerter.It will be dynamically entered into the query right.
    You can mention the Avalibility planning for your interface to work in RWB.
    Go to RWB>Component Monitoring>Adapter Engine->Communication Channel Monitoring>Avaliablity Planning
    Please explain.
    Regards,
    Nutan

  • Executing an Oracle Stored Procedure from Sender JDBC adapter

    I could really use some help from someone who had done this before. 
    I've read the help about using the JDBC sender adapter, but it's not helping enough.
    I found this line: "Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
    The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs."
    That's definately what we want to do, but we can't figure out the syntax.
    The procedure in oracle looks like this:
    CREATE OR REPLACE PROCEDURE test_ref_cursor
    ( cur_generic IN OUT result_sets.cur_generic)
    as
    BEGIN
    Open cur_generic for
    select
       proposal_number,
       to_char(sequence_number),
       column_name,
       column_value,
       update_timestamp,
       update_user
       from
       coeus.sap_test;
    END test_ref_cursor;
    And we have tried every kind of statement we can think of, but the file adapter always gives us an "invalid sql statement" error.
    Does anyone know what syntax we need to put in the "Query SQL Statement" in the JDBC sender adapter in order to call this procedure?  Or is there something wrong with the procedure that is causing the error?
    <i>I will absolutely return and give points, but PLEASE read my whole post before answering and do not just link me to or quote the help for configuring a sender JDBC adapter or blogs that are about the JDBC adapter in general but do not deal with the issues I am having. Thank you.</i>

    Hi Vanda,
    Unfortunately, the sender JDBC adapter does not support Oracle's store procedure/function.  Unlike stored procedures from other database vendors, Oracle returns a cursor, not a resultset.  The sender JDBC adapter must send a resultset to XI.
    There are 2 possible ways you can accomplish this:
    1.  Use BPM and call the Oracle stored procedure using a receiver adapter via a asynch-synch bridge.
    2.  Develop a user-module for the adapter, which can be used with a sender adapter.
    Thanks
    Prasad

  • Using Stored procedure in sender or receiver jdbc adapter

    Hi All,
    Please let me know simple blogs for Stored procedure used in sender or receiver jdbc adapter to get data from 2-3 tables
    Thanks

    Hi
    To work with Store proceudres (SP) you have to create the SP's in database like Oracle, Mssql or Msaccess.
    Ususally the SP creations are done by database experts. For more info about "SP" try Googling!
    The below blog is about SP but not the one you expect!
    /people/itisha.alok/blog/2009/03/23/jdbc-stored-procedure-returning-multiple-resultsets
    Executing an Oracle Stored Procedure from Sender JDBC adapter
    Sender Adapter - -
    SP will contain the select Query alone or with it will contain insert, delete statement too.
    Receiver:
    SP will have insert or delete satement.
    Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/frameset.htm
    The below details are required  to configure the adapters
    Driver details
    database name
    Procedure name
    user name
    password,
    Regards
    Ramg

  • Stored procedure by using jdbc sender adapter.

    Hi All
    I need to call the stored procedure and make it as sender how do design data type to make stored procedure as sender
    Thanks
    Jeongbok.

    Hi Jeong;
    The Data type structure will be like
    row
      field1
      field2
      field3
    the name of the fields will be same as defined in your stored procedure
    Mudit

  • Stored procedure by a JDBC sender

    Hi,
    My scenario involves accessing an SQL server to XI to APO.
    I need to invoke a stored procedure residing on SQL server in order to get the data into XI.
    Can somebody suggest how i acheive this.
    It has to be done every month...so is there a way i can schedule the JDBC sender adapter
    Thanks,
    Vineet

    Hi Vineet,
    Yes, of course you can invoke Stored Procedures on SQL server using XI. The link you are looking for is this:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
    The only limitation is that you can have only one SELECT statement in the Stored Procedure.
    Regards,
    Puloma.

  • Stored Procedure call from JDBC sender for Oracle Database

    Hi,
    I have a requirement to call stored procedure using JDBC sender adapter for retriving data from an Oracle database.
    I need to execute first stored procedure call from Querry SQL statement and then trigger second stored procedure call for confirming the succesful retrival of those records from the update SQL statement.
    Querries:
    1. Can we trigger stored procedure from Update statement of JDBC sender.
    2. Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
    3. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
    Please note PI does not have direct access to main table and hence the need to have separate stored procedure calls.
    The PI version is PI 7.11 sp4.
    Appreciate your inputs.
    Thanks.
    Siddhesh S.Tawate

    >1. Can we trigger stored procedure from Update statement of JDBC sender.
    I think not possible using update statement.
    > Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
    Yes using select query you can call stored procedure.
    >. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
    No select and update handles in the same session using the same thread so if one transaction fails update should not proceed.

  • When would you write a stored procedure in sender/receiver jdbc adapter

    Hi Everybody
    Can you tell any situation where you would need to write a stored procedure in the query sql statement of sender/ receiver jdbc adapter instead of writing SELECT statement there
    why do we need to write stored procedures
    thanks and regards,
    Anitha

    Hi Anitha,
    why do we need to write stored procedures
    Some times a single SQL statement will not suffice for ur transactions....
    Say u want to access from 2 tables and update based on some condition..
    or nested select statement...
    or u want to update a 2 nd table based on the values from 1st table... etc..
    In those places it's preferable for going for a Stored Procedure.
    The Stored Procedure can be used in both Sender and Receiver JDBC Adapter.
    Still nt clarified do post..
    Babu

  • How to put Stored Procedure in Receiver JDBC channel

    Hi all,Good Evening,Iam using a JDBC to JDBC scenario in which I have to move the data from database into XI and we all know that the Interfaces which require stored procedures on Oracle database server for publishing the data needs to be called in combination of BPM & Receiver JDBC adapter.
            In this method, a dummy interface will be created for triggering the process. This interface could be designed using any adapter which works on polling mechanism (sender JDBC/File). Dummy interface will invoke a small BPM designed for each business object. BPM will make a synchronous call to Oracle database by calling underlying stored procedure. Stored procedure will return the result set by using a cursor. BPM will send this result set to target application.
            Now my question is how to put a stored procedure in a receiver JDBC channel which need to collect the data from database when BPM makes a synchronous call.
           Because it is required in my scenario,can any one tell me how and where to put stored Procedure in JDBC receiver channel.
    Thanks in advance,
    Regards,
    Prajwal

    Your action should be EXECUTE for stored procedures in Message mapping.
    <StatementName5>
    <storedProcedureName action=u201D EXECUTEu201D>
        <table>realStoredProcedureeName</table>
    <param1 [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</param1>
    </storedProcedureName > 
    </StatementName5>
    action=EXECUTE
    Statements with this action result in a stored procedure being executed. The name of the element is interpreted as the name of the stored procedure in the database. If you use the optional <table> element, the value specified here is used as the stored procedure name. This enables you, for example, to define stored procedure names containing non-XML-compatible characters or characters that prevent them from being used in interface definitions in the Integration Builder/PCK.  If specified, <table> must be the first element in the block within <dbTableName>.
    The elements within the stored procedure are interpreted as parameters. They can optionally have the attribute isInput=u201C1u201C (input parameter) or isOutput=u201C1u201C (output parameter) or both (INOUT parameter). If both attributes are missing, the element is interpreted as an input parameter. The parameter names must be identical to those of the stored procedure definition.
    The attribute type=<SQL-Datatype> , which describes the valid SQL data type, is mandatory for all parameter types (IN, OUT, INOUT).
    http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    /people/sap.user72/blog/2005/10/15/jdbc-adapter-execution-mode-chained-or-unchained
    /people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi

  • Is it possible to execute a stored procedure using the JDBC adapter?

    Hi all,
    Can anybody confirm whether we can execute a stored procedure created in a database using the processing parameters of a JDBC adapter of a communication channel?
    If yes, then please let me know how (may be with an example)
    Thanks.

    Yes, that is possible. You have to chose EXECUTE in the action field to execute the stored procedure. Here's a little piece on the JDBC receiver:
    JDBC Receiver
    For writing data to an SQL database you also need to define a strict data type. The general format is like this:
        <ns:MT_RECORDSET>
              <STATEMENT>
                   <TABLE_NAME ACTION="">
                        <TABLE/>
                        <ACCESS>
                             <FIELD1/>
                             <FIELD2/>
                             <FIELDn/>
                        </ACCESS>
                        <KEY>
                             <ID compareOperation=""/>
                             <FIELDx compareOperation=""/>
                        </KEY>
                   </TABLE_NAME>
              </STATEMENT>
    </ns:MT_RECORDSET>
    This recordset represents an SQL statement like "update TABLE1 set FIELD1=123, FIELD2=456, FIELDn='xyz' where ID=12345 and FIELDx is NULL"
    MT_RECORDSET is the name of the Message Type used.
      For the value of the attribute ACTION you can choose from the following values:
         UPDATE : updates the given fields in the table with their new values
         INSERT : insert the given fields as a new row in the table
         UPDATE_INSERT : insert rows in the table when update is not possible
         DELETE : deletes given fields from the table
         SELECT : selects given fields from the table. Note that this option returns a response in the JDBC Sender form!
         EXECUTE : execution of a stored SQL procedure
         SQL_QUERY | SQL_DML : option to transfer more complex SQL statements to the database
      The attribute compareOperation can have the following values:
         EQ : equal
         NEQ : not equal
         LT : less than
         LTEQ : less than or equal to
         GT : greater than
         GTEQ : greater than or equal to
         LIKE : used to compare strings

  • DML visibility in stored procedures called via JDBC

    Hello,
    I have two stored procedures, A and B. Proc A inserts Q into table X. Proc B selects Q from table X to insert it into table Y. Neither procedure does a COMMIT.
    My Java class executes Proc A and then Proc B within a transaction (autocommit is false). But Proc B fails to select Q from table X with the No Data Found error, apparently unable to see the recently inserted Q.
    If these two procedures are called from a SQL*Plus block, everything succeeds.
    Does anyone have a clue about what I am missing? All my DML should be visible to my session.
    Thank you in advance for any suggestions.
    - CJ

    Thank you, Joe, for your reply!
    To the best of my knowledge, all of my stored procedure calls are being made from the same connection so I can rollback everything if necessary. I have not explicitly closed the connection between calls. The debugger indicates my connection session id never changes across calls.
    Do you know of any JDBC trace tools that might help me verify my connections? I've enabled logging with oracle.jdbc.driver.OracleLog.setTrace(true) but it doesn't really give me specific connection information - at least not that I can tell. :)
    Thanks!
    Cori

Maybe you are looking for

  • How to include the SharePoint engine in my Office 365 Enterprise E3?

    I signed up for the Office 365 Enterprise E3 wanting to create a MS Access Web application, apparently MS Access requires SharePoint, I do have the SharePoint Designer however it requires the SharePoint Foundation or Server, netierh of which can run

  • Query taking much time.

    Hi All, I have one query which is taking much time in dev envi where data size is very small and planning to implement this query in production database where database size is huge. Plz let me know how I can optimize this query. select count(*) from

  • CS6 Bridge Stops Working

    My CS6 bridge is crashing. I have CS6 Master Suite edition. When I open it up regularly or as administrator it opens up fine but when I either click on a file or a photo I receive a message that Bridge CS6 has stopped working. Also my Mini Bridge in

  • Remove Cascading Style Sheets language from html

    Hello, I need to remove the Cascading Style Sheets language from the html file by using the html parser. Please help. Thanks.

  • STS hierarchy error

    STS hierarchy error Hi there After we upgraded to BI 7.0 and SEM 6.0 we are facing problem with the STS hierarchy. Before the upgrade each user will go to the planning page corresponding to his/her assigned department directly. After the upgrade, all