JDBC Adapter - Multiple Resultsets

Hello,
Does anyone know if the JDBC adapter can return multiple resultsets?
So something like the following JDBC Code:
CallableStatement cstmt;
ResultSet rs;
int i;
String s;
cstmt.execute();       //Call the stored procedure      
rs = cstmt.getResultSet(); //Get the first resultset
while (rs.next()) {
i = rs.getInt(1);                          System.out.println("Value from first set = " + i); 
cstmt.getMoreResults();//Point to the second resultset  rs = cstmt.getResultSet();// Get the second resultset
while (rs.next()) {
s = rs.getString(1);                 
System.out.println("Value from second resultset = " + s);
Greetings,
Bart

Hi Bart,
sure you can select more than one table either with Stored Procedue or with Query Statement for example (also if you concate more than one SQL statement) like:
update table1 set STATUS = 4 where STATUS = 3 select *
from table1 bk inner join table2 on (KEY = BZ_KEY) where KEY = 449070
- or you create an View onb DB side that makes all of your Data selection:
select * from view where status = 4
- but you also can use stored procedure - in my opinion the most powerfuel tool...
If their is something left -keep asking
Regards Matt

Similar Messages

  • JDBC Adapter - Multiple Table Update - Sequence Number

    I have to design a integration scenario where I will be updating 4 tables in a oracle database. One of these tables is a header table and the rest are detail tables. I have to generate a sequence number using Oracle Sequence number object which is one of the columns in the header table.
    How can i use the Oracle SEquence number object to get the next value with JDBC Adapter?

    Use an Enhancement Spot

  • JDBC Adapter multiple Selects

    Hi all,
    we have multiple select statements in one message.
    like this:
      <?xml version="1.0" encoding="UTF-8" ?>
    <ns1:SP10530T_MT xmlns:ns1="urn:lsv.de/TEST/SP10530T/SAPIDMS">
    <ChangeCustomer>
    <TPLSVXI_SP10530T action="SELECT">
      <table>TPLSVXI.SP10530T</table>
    <access>
      <ADSMSG />
      <SSRC />
      <EL_MES_CODE />
      </access>
    <key1>
      <MITARBEITER_ID>1111111</MITARBEITER_ID>
      </key1>
      </TPLSVXI_SP10530T>
      </ChangeCustomer>
    <ChangeCustomer>
    <TPLSVXI_SP10530T action="SELECT">
      <table>TPLSVXI.SP10530T</table>
    <access>
      <ADSMSG />
      <SSRC />
      <EL_MES_CODE />
      </access>
    <key1>
      <MITARBEITER_ID>12232323</MITARBEITER_ID>
      </key1>
      </TPLSVXI_SP10530T>
      </ChangeCustomer>
    <ChangeCustomer>
    <TPLSVXI_SP10530T action="SELECT">
      <table>TPLSVXI.SP10530T</table>
    <access>
      <ADSMSG />
      <SSRC />
      <EL_MES_CODE />
      </access>
    <key1>
      <MITARBEITER_ID>33333333</MITARBEITER_ID>
      </key1>
      </TPLSVXI_SP10530T>
      </ChangeCustomer>
      </ns1:SP10530T_MT>
    the problem ist if statement 2 produce an error statement 3 will never execute!
    i think the adapter have to send statement 3 too??
    regards
    ralf

    Hi Ralf,
    you should divide your statements via message split.
    Regards,
    Udo

  • JDBC Adapter-XML Document Name

    I am working on XI 2.0 and need to change the XML document name I am receiving from an inbound JDBC adapter.  The document I am receiving is:
    <resultset>
      <row>
        <col1>ABC</col1>
        <col2>123</col2>
      </row>
    </resultset>
    I want to receive:
    <MyDocumentName>
      <row>
        <col1>ABC</col1>
        <col2>123</col2>
      </row>
    </MyDocumentName>
    Does anyone know how to override the default "resultset" name from the JDBC adapter???  The reason I need to do this is because my message mapping does not work properly unless I have the Message type of the message from my JDBC adapter as "resultset". 
    Thanks for your help!
    Dan Pettingill

    (Note: I work with Dan Pettingill, the starter of this thread)
    I decompiled the class Renato suggested, but I don't
    think that's going to be the solution.  The DB2XMBProcesser is dependent on XI properly setting the properties values for the jdbc adapter.  DB2XMBProcesser will use a property named "db.documentname" to set the name of the root node of the DB2 results. If no such property is defined, the default value of resultSet is used.
    [documentName = getParaWithDefault("db.documentName", "resultset");]
    Our problem seems to be that XI is not passing along the parameters we define in the adapter configuration.  We've tried numerous combinations and names, but they never take. 
    The only way we can get XI to recognize that we are sending in a documentName parm is to call it "docName".  Any other name is essentially ignored (including db.documentname, documentname, XMB.docName, and a lot of other permutations as well).
    But here is the log from that adapter when we do so.  Not that it sees the value we're setting, but it won't set the documentname parm going to the jdbc.
    2004-08-31 17:33:45 : jdbcListener
    Raw configuration data ***
    Transport protocol: JDBC, version
    Message protocol: JDBC, version
    pollInterval|301
    additionalParameters|true
    jdbcDriver|com.ibm.db2.jcc.DB2Driver
    retryInterval|null
    dbpassword|***
    queryStatement|SELECT * FROM RBPRDB.T1256;
    queueName|null
    autoCommit|false
    updateStatement|Delete from RBPRDB.T1256 Where GUID Is Not Null;
    dbdisconnect|false
    dbuser|r50445
    adapterStatus|active
    isolationLevel|2
    addParameterParams|*** TABLE , 2 ROWS DEFINED ***
    addParameterParams|addParameterParams$0$addParameterParamName$docNamespace
    addParameterParams|addParameterParams$0$addParameterParamValue$urn:freescale.com
    /xi/db2-ims/wms
    addParameterParams|addParameterParams$1$addParameterParamName$docName
    addParameterParams|addParameterParams$1$addParameterParamValue$SelectAckQueue
    pollIntervalMsecs|null
    execute|null
    connectionURL|jdbc:db2://WACCTSO.sps.mot.com:9003/WACCDB2T
    qualityOfService|EO
    Used configuration data ***
    'MessageProtocol': 'JDBC'
    'adapterStatus': 'active'
    'addParameterParams.dbEncoding': ''
    'addParameterParams.docName': 'SelectAckQueue'
    'addParameterParams.docNamespace': 'urn:freescale.com/xi/db2-ims/wms'
    'addParameterParams.docNamespaceScope': 'root'
    'additionalParameters': 'true'
    'autoCommit': 'false'
    'connectionURL': 'jdbc:db2://WACCTSO.sps.mot.com:9003/WACCDB2T'
    'dbdisconnect': 'false'
    'dbencoding': ''
    'dbpassword': '***'
    'dbuser': 'r50445'
    'documentname': 'resultset'
    'documentnamespace': ''
    'execute': ''
    'isolationLevel': '2'
    'jdbcDriver': 'com.ibm.db2.jcc.DB2Driver'
    'pollInterval': '301'
    'pollIntervalMsecs': '0'
    'qualityOfService': 'EO'
    'queryStatement': 'SELECT * FROM RBPRDB.T1256;'
    'retryInterval': '301'
    'updateStatement': 'Delete from RBPRDB.T1256 Where GUID Is Not Null;'
    OK - initialized

  • Stored procedures and JDBC Adapter

    Hey guys ,
    any blog where i canlook up w.r.t. working with  any stored procedure through xi ?
    Appreciate ur help.
    Krishna

    Hi Krishna,
    Here you go-
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Also remember that, Sender JDBC Adapter doesnot support Oracle Stored Procedures. Because Sender JDBC Adapter sends resultset to XI. But Oracle stored procedure returns Cursor.
    I think, if you are using other database then it may support.
    Regards,
    Moorthy

  • Sender JDBC Adapter : Fetch records from multiple tables

    Hi Friends,
    I am using sender JDBC adapter to select few records from DB2 database table.
    This scenario is working fine.
    Now my requirement is to fetch records from 3 tables. These table are independent to each other. There is no primary key or foreign key.
    Please let me know how to write the sql in sender JDBC adapter to fetch records from these 3 tables.
    Thanks,
    Sandeep Maurya

    hi sandeep...
    if the tables are completely independent and do not share any primary / foreign key relation ship...
    why dont u think towards creating a seperate interface for each of them..
    or if u still want to select from multiple table at once..the best way would be to write a stored procedure on the sender side which do all the fetching n processing and pass the final resultset to PI
    or u can think towards fetching the data from 1 table and then in UDF do lookup from other tables..which again is tricky and performace intensive

  • Splitting a message with multiple rows from the JDBC Adapter

    Hi,
    I'd like to split the resultset message with multiple row elements and process each row separately..
    Does someone have this experience?
    Thanx, Peter

    Hi Chandrasekhar,
    I tried to follow your advise, but I'm not able to complete the process correctly.
    Let me explain my process:
    First - output from the JDBC adapter goes into the first receive step. Of course, there are multiple ROW elements. (Should be marked the ingoing message marked in the container as Multiline??)
    The next should be the transformation:
    format of the source message is like
    <message>
      <row>
        <column>w</column>
      </row>
      <row>
        <column>w</column>
      </row>
    </message>
    In the message I have the ROW element as 0..unbounded
    and <column> element exactly 1
    This message should be mapped to multiple messages of the format:
    <message>
      <value>w</value>
    </message>
    How should be the mapping be done?
    Is it N:1 or 1:N (because in another thread there was an 1:N mapping advised)
    Then (as you say) should follow the Block step:
    Which message (container element) should be marked as Multiline? And what does it mean: Current Message?
    Can you give me some advise, when and how to use the multiline mark?
    Thanx a lot, Peter

  • Inserting Multiple Rows into Database Table using JDBC Adapter - Efficiency

    I need to insert multiple rows into a database table using the JDBC adapter (receiver).
    I understand the traditional way of repeating the statement multiple times, each having its <access> element. However, I am just wondering whether this might be performance-inefficient, as it might insert records one by one.
    Is there a way to ensure that the records are inserted into the table as a block, rather than record-by-record?

    Hi Bhavesh/Kanwaljit,
    If we have multiple ACCESS tags then what happens is that the connection to the database is made only once. But the data is inserted row by row.
    Why i am saying this?
    If we add the following in JDBC Adapter..logSQLStatement = true. Then incase of multiple inserts we can see that there are multiple
    <i>Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','1000')
    Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','2000')</i>
    Doesnt this mean that rows are inserted one by one?
    Correct me if i am wrong.
    This does not mean that the transaction is not guaranted. Either all the rows will be inserted or rolled back.
    Regards,
    Sumit

  • Multiple tables In JDBC ADapter

    Hi All,
             Can we access more than 1 table in one JDBC adapter? If yes how?
    XIer

    Hey
    on receiver side create multiple STATEMENT Level tags, one for each table and the appropriate access level tags.
    on sender side you can only have one select Query.
    so try to use a JOIN SQL Statement .
    Thanx
    Aamir
    Message was edited by:
            Aamir Suhail

  • In reciever jdbc adapter config sending data to multiple tables

    Hi Masters,
          Can u help me with examples step by step procedure of sending data to multiple tables in reciever jdbc adapter .. configuration....
    thanks in advance,
    jp.

    Hi,
    My understanding is you are  trying to use one scenario for ex a file to jdbc and want to post data into multiple tables.
    If you are using Message Prortocol XML SQL format then once you define the data type for one structure then juz right click on the statement name and select Duplicate. This will create another statement in the same data type change the table name and the parameters in the duplicates strucutre.
    <b>Document Formats for the Receiver JDBC Adapter</b>
    http://help.sap.com/saphelp_nw70/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    All the other configurations are same simple file to jdbc scenario.
    Cheers,
    *RAJ*

  • Updating multpile tables and multiple rows - JDBC adapter

    Hi,
    The scenario is like this. i receive an Idoc which has header information and various line items (multiple occurrance of a segment). the hearder details have to be sent to one table, TableA, and all line items has to go to another table, TableB, and for each line item, a new row has to be inserted in TableB.
    How can i acheive this using JDBC adapter? how should my data type look like? what are the settings i need to do in adapter config?
    Thanks and Regards,
    Rashmi

    Hi Rashmi,
    You can use the following link for the JDBC adapter call :
    http://help.sap.com/saphelp_nw04/helpdata/en/ae/d03341771b4c0de10000000a1550b0/frameset.htm
    You need to provide the JDBC Driver, Connection,User Name and the password.
    The data type structure you can take from the Bhavesh blog:
    JDBC Receiver Adapter -- Synchronous Select – Step by Step
    Since you just need to update the tables, take only the sender side of the blog, i.e. the request part and configure the scenario accordingly.
    Regards,
    Sanjeev.

  • Updating multiple tables using JDBC Adapter

    Hi,
    I am trying to insert/update multiple tables using one message via JDBC adapter. The following is the message being posted. However, only the first statement was executed. Anything wrong?
    Thanks in advance!
    Hart
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration"><DeliveryData><DelHeader action="UPDATE_INSERT"><table>DelHeader</table><access><DelNo>0080000230</DelNo><DelType>LF</DelType><XOverwrite>X</XOverwrite><ShipTo>0000000026</ShipTo><SoldTo>0000000026</SoldTo><Priority>00</Priority><DocDate>02/17/2007</DocDate><GText>CIF Test</GText><DelDate>02/20/2007</DelDate><PickDate>02/20/2007</PickDate><ShipPoint>NO02</ShipPoint><PackCount>00000</PackCount></access><key><DelNo>0080000230</DelNo></key></DelHeader>
    <DelItem action="INSERT"><table>DelItem</table><access><DelNo>0080000230</DelNo><ItemNo>000010</ItemNo><GText>10# GRAN-GREAT VALUE</GText><Material>G04410G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BL</UOM></access><access><DelNo>0080000230</DelNo><ItemNo>000020</ItemNo><GText>25# GRAN- GREAT VALUE</GText><Material>G04025G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BG</UOM></access></DelItem></DeliveryData></ns0:DeliveryDBUpdate>

    Hi,
    You need 2 STATEMENT level tags,
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration">
    <b><DeliveryData1></b>
    <DelHeader action="UPDATE_INSERT">
    <table>DelHeader</table>
    <access>
    <DelNo>0080000230</DelNo>
    <DelType>LF</DelType>
    <XOverwrite>X</XOverwrite>
    <ShipTo>0000000026</ShipTo>
    <SoldTo>0000000026</SoldTo>
    <Priority>00</Priority>
    <DocDate>02/17/2007</DocDate>
    <GText>CIF est</GText>
    <DelDate>02/20/2007</DelDate>
    <PickDate>02/20/2007</PickDate>
    <ShipPoint>NO02</ShipPoint>
    <PackCount>00000</PackCount>
    </access>
    <key>
    <DelNo>0080000230</DelNo>
    </key>
    </DelHeader>
    <b><DeliveryData1></b>
    <b><DeliveryData2></b>
    <DelItem action="INSERT">
    <table>DelItem</table>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000010</ItemNo>
    <GText>10# GRAN-GREAT VALUE</GText>
    <Material>G04410G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BL</UOM>
    </access>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000020</ItemNo>
    <GText>25# GRAN- GREAT VALUE</GText>
    <Material>G04025G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BG</UOM>
    </access>
    </DelItem>
    <b></DeliveryData2></b>
    </ns0:DeliveryDBUpdate>
    Try with such a strcuture and let us know if it works.
    Regards
    Bhavesh

  • Multiple table insert using receiver jdbc adapter

    Hi,
    I am trying to insert data in to two tables in a single structure using receiver jdbc adapter. I am not using any stored procedure to insert data instead directly inserting the data using PI. Please see the structure I am using.
    SOURCE side:
    DT_ABC_SENDER
    --IT_HEADER_TEXT
      -- EBELN
      -- LINENO
      --TDTEXT
    --IT_ITEM_TEXT
      -- EBELN
      -- LINENO
      --TDLINE
    TARGET side:
    DT_ABC_RECEIVER
    --InsertStatement
         --HEADER_TEXT
                -- action                         (insert)
                -- Table                          (Table 1)
                --access
                     -- IDS_ENQ_NO
                     -- IDS_DESC
                     -- IDS_TEXT
       --ITEM_TEXT
                -- action                         (insert)
                -- Table                          (Table 2)
                --access
                     -- IIS_ENQ_NO
                     -- IIS_DESC
                     -- IIS_TEXT
    Using the above structure I am able to successfully insert the data in Table 1 but data is not getting inserted in Table 2.
    In sxmb_moni it is saying message successfully delivered but I but there is data insertion took place in Table 2.
    Please help me urgently.
    Thanks in advance.
    Neeeraj

    Hi Neeraj,
    Add --InsertStatement statement for the second table structure in the same level of first InsertStatement.
    Target structure like this:
    DT_ABC_RECEIVER
    --InsertStatement
         --HEADER_TEXT
                -- action                         (insert)
                -- Table                          (Table 1)
                --access
                     -- IDS_ENQ_NO
                     -- IDS_DESC
                     -- IDS_TEXT
    --InsertStatement
       --ITEM_TEXT
                -- action                         (insert)
                -- Table                          (Table 2)
                --access
                     -- IIS_ENQ_NO
                     -- IIS_DESC
                     -- IIS_TEXT

  • Structure for Receiver Jdbc adapter for multiple tables

    Hi,
    For Receiver JDBC adapter,Standard structure
    structure as
    Statement
       Tablename(TABLE1)
            Action
            Access
    Can i make a structure like
    Statement
         Tablename(TABLE1)
            Action
            Access
                fields....
         Tablename(TABLE2)
            Action
            Access
                fields......
    As i am using tables and I want to insert or update both of them or one based on some conditions.
    Will Insert be possible in single Statement or I have to create separate statements for each table. Can you please help me on this?
    Thanks in advance
    Best Regards,
    Harleen Kaur Chadha

    Hi Harleen,
            As already said by Dharanveer, all that you need to do is replicate the Statement level, so, istead of using this structure:
    Statement
    Tablename(TABLE1)
       Action
       Access
         fields....
    Tablename(TABLE2)
       Action
       Access
         fields......
            You will construct something like this:
    Statement1
    Tablename(TABLE1)
       Action
       Access
         fields....
    Statement2
    Tablename(TABLE2)
       Action
       Access
         fields......
           And this structure will be created in a single Data Type, that will be used to create a single Message Type, that you will use in your Message Mapping, and, the 2(or more tables that you need to manipulate) will be inserted/updated without problems using this approach.
           Thank you, and best regards,
           Wilson

  • JDBC adapter to SAP: select & join from multiple tables ???

    Hello,
    I have a task to get an aggregating information from two tables and send it into SAP.
    I use XI JDBC sender adapter to access to MSSQL DB.
    I know how to construct SQL quiery:
    (something like that)
    SELECT  table1.Date  SUM(table1.sum) from table1
    INNER JOIN table2
    ON table1.Number = table2.Number
    But I don't understand how to construct  Data Type for this complex select operator?
    How does it look like?
    Where to store and how to map the selected data?
    Please give me an example or an advice.
    Thank You.

    Hi,
    Use your structure like this.
    <StatementName4>
    <dbTableName action=”SELECT”>
    <table>realDbTableName</table>
    <access>
    <col1/>
    <col2/>
    <col3/>
    </access>
    <key1>
    <col2>val2old</col2>
    <col4>val4</col4>
    </key1>
    <key2>
    <col2>val2old2</col2>
    </key2>
    </dbTableName>
    </StatementName4>
    action=SELECT
    Statements with this action cause existing table values to be selected. Therefore, the statement corresponds to an SQL SELECT statement.
    The <access> block contains the column names to be selected, a <key> element contains the columns whose values must be identical with the specified value to get the new column values. The name of the <key> element is arbitrary. Column values within a <key> element are combined with a logical AND; different <key> elements are combined with a logical OR.
    A statement with the action SELECT must have exactly one <access> element. The number of <key> elements with arbitrary names is not restricted.
    The corresponding SQL statement for StatementName4 in the example above is as follows:
    SELECT col1,col2,col3 FROM dbTableName WHERE ((col2=’val2old’ AND col4=’val4’) OR (col2=’val2old2’))
    If there is no <key> element, or if there is a <key> element but it is empty, then no condition is specified and the entire table is to be selected. This may not be permitted by the configuration of the JDBC adapter for security reasons and will therefore result in an error during message processing and an appropriate error message.
    The response document contains the result of the action in XML format as follows:
    <row>
    <column1>value11</column1>
    <column2>value12</column2>
    </row>
    <row>
    <column1>valueN1</column1>
    <column2>valueN2</column2>
    </row>
    This will help you.
    regards
    Aashish Sinha
    PS : reward points if helpful

Maybe you are looking for