Synchronous JDBC select

hi,
Based on the call from webservice I need to select data from two tables and send back. Expected output is one row from one table and multiple rows from the other. So I created a structure as shown:
  <?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_DB_PS_Req xmlns:ns0="http://timken.com/poc/webservices">
- <Statement>
- <Table action="SELECT">
  <table>poc.order_operation</table>
- <access>
  <plant />
  <work_center_id />
  <work_center />
  <operation_status />
  <material_produced />
  <order_quantity />
  <quantity_uom />
  <quantity_completed />
  <quantity_scrapped />
  <activity />
  <std_activity_quantity />
  <actual_activity_quantity />
  <activity_quantity_uom />
  <activity_start_time />
  <activity_end_time />
  <description />
  </access>
- <key>
  <order_number>String</order_number>
  <operation_id>String</operation_id>
  <routing_seq_num>int</routing_seq_num>
  </key>
  </Table>
  </Statement>
- <Statement1>
- <Table action="SELECT">
  <table>poc.operation_material</table>
- <access>
  <material_id />
  <material_source />
  <std_material_usage />
  <actual_material_usage />
  <usage_uom />
  </access>
- <key1>
  <order_number>String</order_number>
  <operation_id>String</operation_id>
  <routing_seq_num>int</routing_seq_num>
  </key1>
  </Table>
  </Statement1>
  </ns0:MT_DB_PS_Req>
I am unable to get any output. When I check in RWB the ouptput is shown as:
    <?xml version="1.0" encoding="utf-8" ?>
- <ns0:MT_DB_PS_Req_response xmlns:ns0="http://timken.com/poc/webservices">
  <Statement_response />
  <Statement1_response />
  </ns0:MT_DB_PS_Req_response>
Can someone help me with this.
thank you

Hi,
Check if the Response Messge Type is of this format.
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_DB_PS_Req<b>_response</b> xmlns:ns0="http://timken.com/poc/webservices">
<Statement<b>_response</b>>
<b><row></b>
<plant />
<work_center_id />
<work_center />
<operation_status />
<material_produced />
<order_quantity />
<quantity_uom />
<quantity_completed />
<quantity_scrapped />
<activity />
<std_activity_quantity />
<actual_activity_quantity />
<activity_quantity_uom />
<activity_start_time />
<activity_end_time />
<description />
<b></row></b>
</Statement<b>_response</b>>
<Statement1<b>_response</b>>
<b><row></b>
<material_id />
<material_source />
<std_material_usage />
<actual_material_usage />
<usage_uom />
</row>
</Statement1<b>_response</b>>
</ns0:MT_DB_PS_Req>
Regards,
Bhavesh

Similar Messages

  • Synchronous JDBC adapter(receiver side) with stored procedure

    Hi experts,
    Can some database processing logic be included in receiver JDBC (synchronous) adapter...to put it simply
    I have synchronous JDBC adapter in the receiver side..Using this JDBC adapter I want to get some response back from the table..
    The requirement is not a simple fetch from the table..It involves some processing in the database side which I guess will be done by stored procedure..After this database processing , this output will be picked up by the JDBC adapter and will send to PI.
    How can this be achived ..Any Blog..
    Thanks
    Ayan

    Yes u can use stroed procedure and send back the response,
    refer this link for stored procedure structure.
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    chirag.

  • JDBC/select/async statement to JDBC/stored procedure/sync call

    Hi
    We have JDBC/select/async statement to JDBC/stored procedure/sync call i.e sender and receiver are JDBC.
    PI has to pick all the the records of single internal order number at a time from sender system and upload to receiver JDBc,
    gets the response and routes to sender/insert statement.
    This should run only once per day.
    We will have multiple Internal orders daily, each order consisting of 10 to 20 records but only one IO related records has
    to upload to Receiver/JDBC
    What are the options available ?
    We have thought of following options
    1. SQL query is already to pick, but we have to pick records at one time daily. example: morning,evening or midnight.
       At that time it can pick multiple times but it should not pick through out day
    2. Is there any option in BPM so that we can group IO's at a time and upload ? If so what are the steps need to use
       Any additonal receive step need to be used to pick the records from the table.
    Thanks

    hi
    as i can understando you, you will receive mani IO and you must execute one IO in the receiver SP? if so, you can solve this usssing a ccBPM where you will have to create a mapping(0.N) where the source and the target structure will be the same, the diferrence will be in the occurrance of the target structure which will have to be 0.N (Tab signature in Message Mapping). then back to the ccBPM define a block with the property ForEach. this will  loop any times accord with the number of IO that you receive from the sender. as a result you will execute one SP for each IO.
    so, you ccBPM will be
    RS>TS>BLOCK(Multiline container and single container of source structure)>TS->SS
    RS:Receive Step
    TS:Trans. Step
    SS:Send Step
    Also the container will be:
    source--> type Abs
    source_multiline --> type Abs
    target -->type Abs
    Thanks
    Rodrigo P.
    Edited by: Rodrigo Alejandro Pertierra on Jun 24, 2010 4:54 PM

  • Synchronous Proxy to Synchronous JDBC scenario

    Hi,
    I have a scenario for a synchronous  PROXY  to a synchronous JDBC  scenario. I have set 4 message types .
    MT_PROXYOUT u2013 o/b synch with a response MT_PROXYIN
    MT_JDBC   - i/b synch with a response MT_JDBC_RESPONSE
    I then set up an interface mapping for both the request and response message interfaces. The design looks good but I got stuck in the configuration part.
    Since itu2019s a proxy sender, the sender agreement is not needed(Correct me if I am wrong). In the interface determination, there is provision for only the inbound interface which in case would be the JDBC (request/response) back to the proxy and the interface mapping is applied.
    So do I need just one interface determination from the proxy as sender and jdbc as receiver and also one receiver determination again with the proxy as sender and the jdbc as receiver. I am confused here because when I try to create a receiver determination for the response back from JDBC to proxy receiver , the interface mapping comes blank. Is it taken in account by the single receiver determination in synchronous to synchronous scenarios??
    Teresa

    Hi Teressa,
    Java Proxy to Synchronous JDBC scenario and SAP XI:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a068cf2f-0401-0010-2aa9-f5ae4b2096f9
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f272165e-0401-0010-b4a1-e7eb8903501d
    ABAP proxies-
    Client proxy:
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
    Server Proxies
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies
    Cheers
    Sunil

  • Synchronized JDBC

    Hi this is slighly off topic.
    I'm new to Oracle (not Java) and am calling stored procs,
    using prepareCall, via JDBC (level 4) on Oracle 8.05.
    My Java app will have multiple threads inserting/updating. Do I
    have to synchronize my java calls (performance issue) or can
    Oracle handle multiple synchronous JDBC calls. Generally I would
    synchronize and will do unless someone tells me otherwise.
    Thanks for any help
    Ritchie
    null

    Oracle will handle multiple synchronous JDBC calls. The standard
    row locking behavior will apply though.
    Hope this helps,
    -Chris
    ritchie turner (guest) wrote:
    : Hi this is slighly off topic.
    : I'm new to Oracle (not Java) and am calling stored procs,
    : using prepareCall, via JDBC (level 4) on Oracle 8.05.
    : My Java app will have multiple threads inserting/updating. Do
    I
    : have to synchronize my java calls (performance issue) or can
    : Oracle handle multiple synchronous JDBC calls. Generally I
    would
    : synchronize and will do unless someone tells me otherwise.
    : Thanks for any help
    : Ritchie
    null

  • Synchronous JDBC scenario

    Hi All,
    The scenario is
    SAP Portal will send data to XI using web service(SOAP Adapter) and then XI will post data in Database using JDBC adapter.
    When above scenario executes it is automatically creating response (Synchronous) once it post data in Database (New message in SXI_MONITOR). I have checked message interface both inbound and outbound are asynchronous. When I ran the same scenario using file adapter instead of SAP portal it is not creating new message.
    Please guide how to avoid creating new message in case of SAP Portal .

    Hi,
    The jdbc response is generated in synchronous cases.
    Make sure the webservice call that you are making is asynchronous.
    In case of file adapter the call you made was asynchronous, hence no response was generated.
    Check this blog for configuration for Capturing response message.
    /people/bhavesh.kantilal/blog/2006/07/03/jdbc-receiver-adapter--synchronous-select-150-step-by-step
    - Deepak

  • Response communication for synchronous JDBC channel

    Hi,
    We have a Proxy->XI-> JDBC synchronous interface. Is there a necessity for a response receiver communication channel? We just set one up and it always fails with a select statement "Select * from payroll where enddate = "20081012". I never set up this SELECT statement. Just confused if I really need this response communication channel. Any ideas?
    Teresa

    Hey
    No,you don't need a separate receiver communication channel for response.
    JDBC on receiver side can support synchronous interface.
    >>fails with a select statement
    My guess is that either your mapping is wrong or the receiver/response message structure you have created in Data type is in wrong format.
    JDBC Receiver Adapter -- Synchronous Select – Step by Step
    Thanx
    Aamir
    Edited by: Aamir Suhail on Jul 13, 2008 10:05 PM

  • Synchronous JDBC Timeout

    Hi Experts, I have a synchronous proxy-jdbc with SQL_QUERY (Select) as action. When the query is executed directly in the DB, it's only taking 3-4 minutes to get the results. But when it's run thru PI, we always encounter synchronous timeout exceeded error (20 minutes). Since the query is getting results on time in the DB, I'm thinking the problem could be in PI side but I'm running out of options to check. Has anyone faced this problem before? Any inputs will be greatly appreciated. Thanks!

    Hi Mark,
    It looks like a network problem. Can you ping the database hostname in your PI system (create ping command in SM69)? Also take a look at this note: Note 1085539 - XI JDBC/FTP connection Test and XML Validation Application
    Hope this helps,
    Mark

  • Smart quotes stored in DB are displaying as ? after jdbc select

    I originally posted this to the general forum, but it was suggested that I post it here where Sergiusz Wolicki from Oracle might be able to help.
    I have an Oracle 10 DB set up with the following character set
    NLS_LANGUAGE AMERICAN
    NLS_CHARACTERSET WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET AL16UTF16
    I am connecting to the database using JDBC thin client. I have a web page that is encoded using
    <%@ page language="java" pageEncoding="Windows-1252" contentType="text/html;charset=Windows-1252" %>
    The scenarion I am having problems with is the following. In an input field the user copies a so-called smart quote from Word and submits. I then update the corresponding database field and then return to the page and display the result.
    If I display the string that I wrote to the database back in the page, without selecting it from the database, it displays correctly. However, if I select it from the database and then display it in the page I get a question mark ('?') - note that this is NOT the upside down variety.
    I believe it is inserting it into the database correctly. I can go into sql plus and do a select on the field and it appears to be correct. I can also use the ascii function and it shows the character as character 145. Here is what I did:
    select middle_name from employee where employee_id=100;
    MIDDLE_NAME
    select ascii(middle_name) from employee where employee_id=100;
    ASCII(MIDDLE_NAME)
    145
    So my problem is getting it out of the database and into a java string properly.
    I know I can solve this issue by changing the database character set to UTF-8, but I am not in control of this and it is not an option.
    Thanks in advance for any help on this.

    I suspect this may be the result of bug #4659157. Upgrade your JDBC driver to 10.2.0.4 or to any 11g driver and retest.
    -- Sergiusz

  • Change JDBC select SQL query's where clause at runtime

    Hi,
    I have one JDBC sender channel with Select SQL Query which helps in fetching data from JDE table. We have defined where clause to fetch some particular records i.e. if ABC = NULL then fetch the record.. and then update query is used to turn that flag to "Y" i.e. ABC ="Y" so that next time the channel don't pick the same records again.
    Now the problem is that if we want to fetch some records again whose flag has been set to "Y" we cannot change the select query again and again in the production environment.
    Is there any way to change the select query of the JDBC channel at runtime e.g. Picking up some flat file where the conditions for the particular records to be picked are defined (ID=123) and changing the WHERE clause of select query in the JDBC channel for those records to be picked without using BPM.
    Thank you!
    With regards,
    Simran

    Hi Simran,
    Yes, it is possible with the help of store procedure. In SQL Server there is a IF-Else Conditional block, which you can use inside store procedure. Create a SP with 2 additional parameter something like FlagReadAgain and KeyField. Pass the flag always as True or False. For the Key field pass the record key which you want to read again if you are passing the Flag as True else pass it as 0 or whatever.
    In the procedure check if the value of flag is True -> If yes, Read the entry with key name specified in where part.
    In the else part put the query which you are using for the normal flow.
    IF (FlagReadAgain) = TRUE
    BEGIN
       SELECT EmpName, EmpAddress
       FROM Employee
       WHERE EmpID = 'E001'
    END
    ELSE
       BEGIN
         SELECT EmpName, EmpAddress
         FROM Employee
         WHERE Status = 'N'
       END
    You may also use the approach which Srini mentioned. Create an application to restore any value to intial stage so that it can be picked up by XI when it poll again.
    Choose any approach which you like.
    Regards,
    Jitender Chauhan

  • JDBC: select according to message content

    Hi,
    Is it possible to select data via the JDBC adapter building the SELECT statement using content in the message rather than using a fixed select statement on the communication channel ?
    For instance, there may be a time date in the message that should be used to select records from the database via the JDBC adapter.
    We are on XI 3.0 SP13 currently.
    Kind regards
    Colin.

    Hi Collin,
    >>>Does this mean you have a very simple statement on the comm channel to SELECT all the records that are not flagged as already read by XI and to UPDATE when they have been read ?
    are you talking about jdbc sender or receiver?
    <b>a)</b> if sender: then this is not the only way
    you can also invoke a <b>stored procedure</b> via the
    jdbc sender adapter (in which you can have select based
    on date, time or other dynamic values)
    <b>b)</b> if you're looking for a jdbc receiver adapter
    have a look at Raj's answer and check section:
    <b>action= SQL_QUERY | SQL_DML</b>
    on that page:
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • JDBC SELECT FOR UPDATE

    I'm trying to issue a SELECT ... FROM ... FOR UPDATE, and under specific verified conditions runs an UPDATE (where the current is positioned!).
    The error code I get is:
    ORA-01002: Fetch out of sequence.
    Here you are my code:
    /////////////////////START
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.sql.*;
    public class SelForUpdDin{
    static{
         try{
              Class.forName("oracle.jdbc.driver.OracleDriver");
         catch(Exception e){e.printStackTrace();}
    // Queries and cursor name
    public static void main (java.lang.String[] args){
    String cursorName = null;
    int codice = 0;
    String cognome = null;
    String job = null;
    int manager = 0;
    java.sql.Date dataAss = null;
    int salario = 0;
    int commissioni = 0;
    int reparto = 0;
    String rowid = null;
    String sqlSelect = "SELECT empno, ename, "+
    "job, mgr, hiredate, sal, comm, deptno, ROWID "+
    "FROM scott.emp FOR UPDATE";
    String sqlUpdate = "UPDATE scott.emp SET comm = ? WHERE ROWID = ? ";
    try {
    Connection con = DriverManager.getConnection("jdbc:Oracle:oci8:@","system","manager");
    // Esecuzione della SELECT e produzione del RESULT SET
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery(sqlSelect);
    PreparedStatement ps = con.prepareStatement(sqlUpdate);
    while (rs.next()) {
    codice = rs.getInt(1);
    cognome = rs.getString(2);
    job = rs.getString(3);
    manager = rs.getInt(4);
    dataAss = rs.getDate(5);
    salario = rs.getInt(6);
    commissioni = rs.getInt(7);
    reparto = rs.getInt(8);
    rowid = rs.getString(9);
    // Applicazione della business logic
    if (reparto == 30)
    { System.out.println (cognome + " in dept= "+ reparto +
    " with salary=" + salario + " has a commission= " +
    commissioni);
    int newcomm = 5555;
    ps.setInt(1,newcomm);
    ps.setString(2,rowid);
    ps.executeUpdate();
    else
    { System.out.println (cognome + " in dept= "+ reparto +
    " with salary=" + salario + " has a commission= " + commissioni);
    } // if - else
    } // end while
    rs.close();
    ps.close();
    stmt.close();
    catch(Exception e)
    e.printStackTrace();
    } // end main()
    } // end class
    //PS.
    //Many thanks to Bachar and Elangovan that ansewerd me to my previous posting and addressed me towards the right solution

    Hi
    The documentation gives following explanation for the error :
    ORA-01002 fetch out of sequence
    Cause: In a host language program, a FETCH call was issued out of sequence. A successful parse-and-execute call must be issued before a fetch. This can occur if an attempt was made to FETCH from an active set after all records have been fetched. This may be caused by fetching from a SELECT FOR UPDATE cursor after a commit. A PL/SQL cursor loop implicitly does fetches and may also cause this error.
    Action: Parse and execute a SQL statement before attempting to fetch the data.
    In your program you should set auto commit to false as follows :
    con.setAutoCommit(false);
    Do this before executing the SELECT FOR UPDATE sql query.
    At the end of program you can commit to save the updations as follows:
    con.commit();
    This should solve the problem.
    Chandar

  • Synchronous JDBC structure

    Hi all,
    I have a scenario involving SOAP and JDBC with synchronous calls.
    I have created the source structures with request and response and have no doubt about it.
    The doubt is on the target side (JDBC),
    Have a structure as,
    Name, EmpID and location. Usually the structure for async JDBC goes as,
    Project
      -> Statementname
         -->Storedprocedurename
            -->Action
            -->Table
            -->Name
                -->isInput
                -->type
            -->EmpID
                -->isInput
                -->type
            -->Location
                -->isInput
                -->type
    The response required for this structure would be the Emp ID field. Actually, the source data will send data for Name and Location fields leaving the Emp ID field empty. After it reaches the DB, an Emp ID is generated by the Stored procedure and all the 3 fields is given back as the response with data.
    Do i have to create 2 different JDBC structures, one for request and one for response and to enter isOutput attribute in the response structure or is one structure enough and i create the isInput attributes and the isOutput attributes in the same structure.
    Help me out guys !

    Do i have to create 2 different JDBC structures, one for request and one for response and to enter isOutput attribute in the response structure or is one structure enough and i create the isInput attributes and the isOutput attributes in the same structure.
    You need seperate structure for response.
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures

  • Synchronous JDBC Execute

    Hello all.
    I want to call a stored procedure in a synchronous way.
    So I use the following XML :
      <StatementName5>
    <storedProcedureName action=” EXECUTE”>
        <table>realStoredProcedureeName</table>
    <param1 [isInput=”true”] [isOutput=true] type=SQLDatatype>val1</param1>
    </storedProcedureName > 
      </StatementName5>
    However I want to get ouput parameters that are a string and a boolean.
    Documentation doesn' detail the Response structure I must use.
    Can you help me ?
    Thanks.
    J.C.

    hi,
    have a look at this weblog:
    /people/siva.maranani/blog/2005/09/16/xi-how-to-on-jdbc-receiver-response
    on how to find out the response easily
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Problem in jdbc select statement

    {{  public List dis(int getmodified,int getindex){
    List outerList=null;
    outerList=new ArrayList();
    List display=null;
    try{
         System.out.println("testing.....3");
    con=getconnection();
    pstmt= con.prepareStatement("SELECT title from newss where nno >(10*(?)) and nno <=(10*?)");
         pstmt.setInt(1,getmodified);
         pstmt.setInt(2,getindex);
         System.out.println("testing.....2");
         //pstmt.setInt(1,pgno);
    rs=pstmt.executeQuery();
              while(rs.next())
                   display=new ArrayList();
                   display.add(rs.getString(1));
                   System.out.println("###########################" +rs.getString(1));
                   System.out.println("(((((((((((())))))))))" +display);
                   outerList.add(display);
    }catch(Exception e){
    System.out.println ("exception in select statement" +e.getMessage());
         System.out.println("*************" +outerList);
    return outerList;
    my problem is it says exception in select statement and no data found
    can someone resolve my problem}

    Check the below code snippet this what my fellow poster meant.check whether the proposed works well or not.
    public List dis(int getmodified,int getindex){
        List outerList = new ArrayList();
        List display=null;
         try{
              System.out.println("testing.....3");
              con = getconnection();
              pstmt = con.prepareStatement("SELECT title from newss where nno > ? and nno <= ?");
              pstmt.setInt(1,10*getmodified);
              pstmt.setInt(2,10*getindex);
              System.out.println("testing.....2");
              rs = pstmt.executeQuery();
              while(rs.next()){
                   display=new ArrayList();
                   String title = rs.getString(1);
                   display.add(title);
                  System.out.println("###########################" +title);
                  System.out.println("(((((((((((())))))))))" +display);
                  outerList.add(display);
       }catch(Exception e){
           e.printStackTrace();
       }finally{
           if(rs != null){
                 try{rs.close();}catch(Exception e){e.printStackTrace();}
           if(pstmt != null){
                   try{pstmt.close();}catch(Exception e){e.printStackTrace();}
           if(con != null){
                   try{con.close();}catch(Exception e){e.printStackTrace();}
            con = null;
            pstmt = null;
            rs = null;
       return outerList;
    REGARDS,
    RaHuL

Maybe you are looking for