JDBC sender Adapter consistency and Transaction level - URGENT

Hi,
We are using the JDBC adapter to read data from an Oracle view. The view joins two tables on their keys where flag = 0. The JDBC adapter carries out the select and then updates the selected rows with flag = 1. The transaction level used is the default, which according to XI help is TRANSACTION_SERIALIZABLE.
Our question is what happens if the oracle application that feeds the underlying tables inserts a new record in the time interval between the select statement and the update statement with flag = 0.
WILL THE UPDATE STATEMENT UPDATE EVERYTHING, EVEN THE NEWLY INSERTED RECORD??
As we are in a live environment and we have reason to believe that some records updated to FLAG = 1 are NOT sent to XI we would appreciate the expert's help on this issue!

Dimitris,
I was looking at the FAQ :JDBC Driver Snote and found this information which seems to answer ur question.
Q: If I have the following configured in a JDBC Sender:
Select Query:
SELECT column FROM TABLENAME WHERE FLAG = "TRUE"
Update Query:
UPDATE TABLENAME SET FLAG = "FALSE" WHERE FLAG = "TRUE"
How do I know that the JDBC adapter will not update newly added rows (rows that were added between the time that the SELECT and UPDATE queries were executed) that were not read in the initial SELECT query?
A: The SELECT and the UPDATE are run in the same DB transaction, i.e. both statements have the same view on the database.
Make sure that both statements use the same WHERE clause. An additional requirement for the correct operation of this scenario is the configuration of an appropriate transaction isolation level on the database (i.e., repeatable_read or serializable). You might also consider using a "SELECT FOR UPDATE" statement instead of a plain SELECT statement to ensure proper locking on the database.

Similar Messages

  • Jdbc sender adapter  hangs and starts showing "Processing Started" forever

    Dear ,
              We are facing some issues with jdbc sender adapter channel on production system
              Environment : XI 3.0 SP 20 + HP-UX 11.23 ia64 + Oracle 10.2
    Sometimes it hangs and starts showing "Processing Started" forever on communication channel monitoring .
    There is no error log for this.
    If i stop it and then start it , no use.
    If i copied this to a new one then it works.
    I have found few SAP note like 1078420,1083488 , but my system is already at higher patch level.
    Can you please advise me something as we are facing in production frequently.
    Regards,
    Sandeep

    Hi Sandeep,
    This problem even we too faced in our project and thought of many stupid things finally found that the JDBC adapter is LOCKED.
    Check in the Visual Admin >Cluster> "LOCKING ADAPTER"
    we get a option of Display Locks .Check for an entry with
    NAME : $XIDBAD.JDBC2XI
    reset the locks and restart the CC ,now it works fine.
    Note 1083488 - XI FTP/JDBC sender channel stop polling indefinitely(04/04S)
    Thanks
    Sudharshan

  • JDBC Sender Adapter Threads and DB connections

    Hello,
    I have got a few questions regarding the behaviour of the JDBC sender adapter.
    Suppose I have configured a short polling intervall of 10 seconds. On the first poll a message is processed. How does the JDBC sender adapter behave when there is a second poll after 10 seconds and data is available? Does it wait until the first poll has been processed completely or does it start a second thread processing a second message in parallel? If the latter is true, would a second database connection be retrieved or would both threads share one database connection? What would happen if a large number of unprocessed threads were waiting?
    Kind regards,
    Heiko

    hi heiko,
    whether the first thread is successful or not automatically a new thread is created after the polling interval.if the previous thread is accessing a data the database would lock that one for theat thread so until the lock is released the other thread has to wait for it.so you can see the thread waiting in SAP WEb GUI.There you can see a green indicator on the status column corresponding to the service.
    so a new service is created after the pollling interval irrespective of the pevious service's result and it waits in the queue till its resource is otained.
    configuring sender jdbc to poll a databe is not an advisable one that too this short polling interval.this will increase the queue length and obviously cause performance issues...........

  • JDBC Sender Adapter - Transaction & Parameterized Query?

    Dear Experts,
    I'm curious about the JDBC sender adapter in SAP PI.
    As I see from the document and have been searching in the Internet, The default procedure of the sender JDBC adapter is to first run a SELECT/Store Procedure query then update the records that have been read before.
    Configuring the Sender JDBC Adapter - Advanced Adapter Engine - SAP Library
    What I want to ask is:
    - What is the database transaction used for the SELECT and the UPDATE? I mean what if the SELECT is successful and the records have been sent to the IE, but the UPDATE failed. This way, the next polling run, the same records could be read again. Is it possible? Are the SELECT and UPDATE query atomic (if one fails the other fails too)?
    - Is it possible to have a parameterized query / stored procedure in sender JDBC adapter? Because seeing at the default procedure, there should be at least a field that will be used as a flag (for example the processed field needs to be updated to '1'). Something like:
              - SELECT * FROM table_a WHERE docno > $last_doc_no
                             $last_doc_no is a paramter or variable from PI
              - EXEC sp_do_something ( $param_a, $param_b )
                             $param_a, $param_b are parameters or variable in PI
    Thank you,
    Suwandi C.

    Hi Suwandi,
    all action to database are in one transaction and thats mean if one failed all failed.
    And it is possible to have parameterized storied procedure. You sould send something like
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:mt_proc xmlns:ns0="http://aaaa">
       <statementname>
          <stProc action="EXECUTE"/>
          <TABLE>PROCEDURE NAME</TABLE>
          <access>
             <param_in isInput="1" type="some_type">input param</param_in>
             <param_out isOutput="1" type="some_type"></param_out>
          </access>
       </statementname>
    </ns0:mt_proc>

  • Jdbc Sender Adapter and Acks

    Hi,
    am I right in saying that the JDBC Sender Adapter can't request XI system level acknowledgements. Due to this it is necessary to establish an integrations process fed with the data from the sender adapter, sending it to the target system and receiving an acknowledgement?
    Kind regards,
    Heiko

    Hi heiko,
    a JDBC sender adapter cannot be configured Synchronously and so, what you are stating sounds perfect
    If you want an update back to the database after execution , BPM is one way .
    But, if you are looking to update some info immediately after sender adapter finishes its exectuion, then UPDATE statment can be used.
    Regards,
    Bhavesh

  • JDBC Sender Adapter - Single Select and Single Delete

    Hi,
    I have the requirement where I have to select the single row (or 1st row) from database through JDBC Sender Adapter and delete that record after selection in single polling.
    Please help me out with proper SQL query or with any other approach.
    Thanks and Regards,
    Vijay

    I think in SQL select statment you have something like Select TOP number....where number is 1,2..
    The detailed syntax for the SELECT clause is as follows:
    SELECT [ALL | DISTINCT] [TOP nExpr [PERCENT]] Select_List_Item [AS Column_Name] [, ...]
    for more details...check out..
    http://msdn2.microsoft.com/en-us/library/95c6ex88(VS.80).aspx
    Document sent on your email id.
    Nilesh

  • JDBC sender adapter: Update before mapping

    Dear all,
    following scenario:
    in a database we have a field called "statpi". We pick all messages that have statpi =  0 and
    update the data record to statpi = 1 via UPDATE function in JDBC sender adapter.
    Every select statement is limited to 100 data records for each message in PI.
    But if one data record is wrong and the mapping failed, of course the complete mapping failed.
    My problem: The update function of the JDBC sender adapter has already updated the
    data records, although they didn't have been send to target system.
    What I need is following thing: The adapter should send the messages and after PI has mapped
    the message and send it to target system, the UPDATE command should be executed.
    In my opinion, this is only possible with BPM, but I am not familiar with Advanced mode in JDBC
    sender adapter and "Transaction isolation level". Is there any workaround for this?
    Thanks
    Regards
    Chris

    Stefan Grube wrote:>
    > What happens, when new values have entered db meanwhile?
    The job that change the DB will be fixed on a certain time. We need to configure
    Availability Time Planning to be sure, that we start our select at another time.

    > > In ideal case the data records are still in statpi=0 and get picked up after
    > > the database team has fixed the problem and the adapter polls again.
    >
    > If the flag is not set, the JDBC adapter would poll the same data again and again.
    The adapter should poll every hour. Of course we will have some errors before the
    support is able to fix this problem, but because of one message each hour this should
    not be the main problem.
    > - You could do following: pass the values with an error flag, so you can handle this in receiver application,
    I am using the function formatNumber for the field that could raised the error. But to chekc if I am able
    to do a workaround here and let the target system fix the error sounds like an interessting possibility.
    > - Do a split mapping and create a file where you drop any wrong lines
    Also interessting. You mean that all "good" record should be mapped to struc1 and the bad one to struc2.
    I am thinking of how to determine which record is wrong. Perhaps with an UDF that checks for this special
    error.
    > - Use XML validation in sender adpter, so the messages are not processed.
    You are full of good ideas. I am not using validation yet and the mentioned field is define as string, but that
    is changeable. A good possibility to check the new capability of 7.1.
    > - use a stored procedure in DB whee you check data quality to send out.
    not sure what this is, but I will discuss with DB team.

  • XI 30 SP14: JDBC Sender Adapter

    Hi all,
    we made a jdbc adapter that start a stored procedure and return a value; the QoS is EO. 'til SP12, all works fine, but when we patch to SP14, our bpm, that consist of few steps of which the first is the receiver for the JDBC sender adapter, goes in loop, generating hundreds of messages in a few seconds, until we made the adapter inactive.
    Any help would be appreciated.
    ED

    Hi,
    we don't had this problem but a lots of others - so be sure you have installed the latest Patch Level (i think #4 is the current) of SP14. But it's really buggy.
    Regards Matt

  • Update- statement in JDBC sender Adapter

    Hi ,
    I have a requirement where I am trying to fetch data from ODS based on some flag and immediately I want to update the flag status . So I used selected and update in JDBC sender adapter .
    But I have one question , in the small timeframe where  XI has done a select and just before  XI could  issue the update statement  if a new record is added to ODS . Then  that new record will also get updated though it wasnot selected in select statement .
    Can someone let me know how to overcome this problem ; as I want to make sure I update only those recrods which are selected in select statement ??
    Thanks & Regards,
    Suvarna

    Hi,
    Check out the following thread. It gives the exact answer to this question.
    JDBC Sender Update Query
    One of the replies in the above thread:
    I put in an OSS note asking this exact question with your specific example, and got a reply. I was referred to OSS note 0000831162, where it is explained very unambiguously that the SELECT and UPDATE queries are run in the same transaction.
    Regards,
    P.Venkat
    Message was edited by:
            Venkataramanan

  • JDBC Sender adapter - message split

    All,
    Scenario:
    Oracle Stage table - PI - ECC or R3, (depending on a particular value the record goes to ECC or R3 to post a transaction).
    After the record is picked, flag is updated and depending on posting the transaction on SAP, the flag is updated in the stage table.
    With the JDBC sender adapter, multiple records are picked up depending on the select statement in the sender comm channel.
    I have the following rek.
    Now the message is in the AE, before the message enters IE, I would like to split the messages
    This would help me in resubmitting the failed (failed to post the transaction) records.
    Is there any way that I would be able to do it?
    Any guidence...
    reg

    Hi Naveen,
    An alternative way , instead of splitting the multiple record being picked up in a single poll,  you can control the number of records being picked. By using the following statement in the sender cc
    SELECT * FROM ....   UPTO ROWS <  20
    so that only 20 records are picked at a time. and resubmit the set of 20 in case it fails.
    You can go for this method if it suits your requirement.
    Regards,
    Shamly

  • JDBC Sender Adapter : java.sql.SQLException: Cursor state not valid.

    Hello all,
    We have configured JDBC Sender Adapter which fetches around 10K records with poll interval 1hr  from DB2 System .
    It was working fine,suddenly it started throwing an exception in Adapter Monitoring :
    Error during conversion of query result to XML: java.sql.SQLException: Cursor state not valid.
    It is not fetching any records.
    Without changing any configurations when we tried to fetch to around 1000 records it's working fine.
    For 10K records same exception persists
    What could be the reason ?How to resolve this issue?
    regards
    GangaPrasad

    Hello Christophe ,
    Trace in VA :::
    Date : 05/09/2008
    Time : 11:45:57:750
    Message : Unexpected error converting database resultset to XML, reason: java.sql.SQLException: Cursor state not valid.
         at java.lang.Throwable.<init>(Throwable.java:194)
         at java.lang.Exception.<init>(Exception.java:41)
         at java.sql.SQLException.<init>(SQLException.java:40)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
         at com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3580)
         at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3223)
         at sun.reflect.GeneratedMethodAccessor459222074.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:309)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.TraceInvocationHandler.invoke(TraceInvocationHandler.java:45)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.$Proxy254.getString(Unknown Source)
         at com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(JDBC2XI.java:954)
         at com.sap.aii.adapter.jdbc.JDBC2XI.invoke(JDBC2XI.java:492)
         at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:475)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:99)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:119)
    Severity : Error
    Category : /Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC
    Location : com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(ResultSet, ResultSetMetaData)
    Application :
    Thread : XI JDBC2XI[JDBC_SND_DB2_VehicleReceiving/DB2PRD00/]_170
    Datasource : 12428950:/usr/sap/PXI/DVEBMGS01/j2ee/cluster/server0/log/applications/com.sap.xi/xi.log
    Message ID : 00145E742794005E0014980B000000BE00044CC763766C4F
    Source Name : /Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC
    Argument Objs : java.sql.SQLException: Cursor state not valid.
         at java.lang.Throwable.<init>(Throwable.java:194)
         at java.lang.Exception.<init>(Exception.java:41)
         at java.sql.SQLException.<init>(SQLException.java:40)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
         at com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3580)
         at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3223)
         at sun.reflect.GeneratedMethodAccessor459222074.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:309)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.TraceInvocationHandler.invoke(TraceInvocationHandler.java:45)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.$Proxy254.getString(Unknown Source)
         at com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(JDBC2XI.java:954)
         at com.sap.aii.adapter.jdbc.JDBC2XI.invoke(JDBC2XI.java:492)
         at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:475)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:99)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:119)
    Arguments : java.sql.SQLException: Cursor state not valid.
         at java.lang.Throwable.<init>(Throwable.java:194)
         at java.lang.Exception.<init>(Exception.java:41)
         at java.sql.SQLException.<init>(SQLException.java:40)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
         at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
         at com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3580)
         at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3223)
         at sun.reflect.GeneratedMethodAccessor459222074.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:309)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.TraceInvocationHandler.invoke(TraceInvocationHandler.java:45)
         at com.sap.aii.adapter.jdbc.sql.jdbctrace.$Proxy254.getString(Unknown Source)
         at com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(JDBC2XI.java:954)
         at com.sap.aii.adapter.jdbc.JDBC2XI.invoke(JDBC2XI.java:492)
         at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:475)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:99)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:119)
    Dsr Component :
    Dsr Transaction : d1f629d01d9b11dd984200145e742794
    Dsr User :
    Indent : 0
    Level : 0
    Message Code :
    Message Type : 1
    Relatives : com.sap.aii.adapter.jdbc.JDBC2XI
    Resource Bundlename :
    Session : 0
    Source : /Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC
    ThreadObject : XI JDBC2XI[JDBC_SND_DB2_VehicleReceiving/DB2PRD00/]_170
    Transaction : SAP J2EE Engine JTA Transaction : [0ffffffbdffffffa6ffffff960086]
    User : J2EE_GUEST
    Regards
    Ganga Prasad

  • How to update two tables in a single call using JDBC Sender adapter

    Hello All,
    The scenario is, database entries have to be selected from two tables and at the same time those tables have to be udpated with the flag.
    We are using JDBC sender adapter and in Select Query, we are fetching the data by joinin the two tables.
    Update Statemtent: We can only update one table using this statement.
    Is it possible to update two tables using the Update Statement without using Stored Procedures.
    Let me know.
    Regards,
    Sreenivas.

    Hi Sreenivas,
    > Is it possible to update two tables using the Update Statement without using Stored Procedures.
    Yes its possible through join statement
    Check this links
    Update in JDBC Sender adapter for more than one table
    data from 2 tables for jdbc sender adapter
    Regards
    Ramesh

  • JDBC Sender Adapter - Records sent one at a time

    Hello everyone,
    Here's a summary of my scenario JDBC > XI > RFC.
    My select statement (JDBC) looks like this:
    SELECT * FROM BATCH WHERE STATUS='Y'
    The problem is, whenever it returns multiple rows, the RFC can only accept one record at a time (1...1), so I need to pick up the records from the DB and send them one at a time.
    Currently, this is how the output XML looks like:
    <?xml version="1.0" encoding="utf-8" ?>
      <ns:SQL_RESP_MT xmlns:ns="http://www.pharmaindustries.com">
      <row>
      <number>200000000472</number>
      <status>Y</status>
      </row>
      <row>
      <number>200000000473</number>
      <status>Y</status>
      </row>
      <row>
      <number>200000000474</number>
      <status>Y</status>
      </row>
    </ns:SQL_RESP_MT>
    Instead, I need each row to be picked up and sent one at a time.
    <?xml version="1.0" encoding="utf-8" ?>
      <ns:SQL_RESP_MT xmlns:ns="http://www.pharmaindustries.com">
      <row>
      <number>200000000472</number>
      <status>Y</status>
    </ns:SQL_RESP_MT>
    <?xml version="1.0" encoding="utf-8" ?>
      <ns:SQL_RESP_MT xmlns:ns="http://www.pharmaindustries.com">
      <number>200000000473</number>
      <status>Y</status>
      </row>
    </ns:SQL_RESP_MT>
    <?xml version="1.0" encoding="utf-8" ?>
      <ns:SQL_RESP_MT xmlns:ns="http://www.pharmaindustries.com">
      <number>200000000474</number>
      <status>Y</status>
      </row>
    </ns:SQL_RESP_MT>
    Does anyone know the changes I need to make in my current SELECT statement or the JDBC Sender Adapter to make this possible.
    Thanks in advance!
    Glenn

    Thank you all for your replies. I'll check out your link in a bit, Phani. Thanks!
    A SpliByValue won't work since the BAPI Header is (1...1).
    Luckily, during testing, I found out that the BAPI (BAPI_PRODORDCONF_CREATE_TT) handles multiple lines in one of the subelements of the header so that was where I mapped the Rows.
    I might need to trigger multiple BAPIs in the future, so I'll take a good look at your suggestions, but for now, I'm marking this question answered.
    Warm regards,
    Glenn

  • In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String

    In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .

    Hi Srinath,
    The below blog might be useful
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
    PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
    regards,
    Harish

  • Event Handling in JDBC sender adapter

    Hi,
    please help me in this scenario.
    Scenario is Third Party will update the Header and Item values in to Database table.
    Once the update is done , a program will run in Thrid party system and it will update the Event Table with the primary key value of the DB table.
    So my JDBC sender should be looking for the event table updation. Whenever there is an update in the event table the JDBC sender should automatically kicked off and it should select all the field in the DB table where the primary key = Event table.primary key and the values will be generated as an Idoc.
    1.How will i achive this scenario.
    2.How to configure the JDBC sender Adapter which gets triggered automatically when there is an updation in event table.
    please advice.
    Thanks,
    Sujatha

    Hi,
    >>2.How to configure the JDBC sender Adapter which gets triggered automatically when there is an updation in event table.
    There is way to control the Communciation Channel externally. Refer this help document http://help.sap.com/saphelp_nw04/helpdata/EN/45/0c86aab4d14dece10000000a11466f/content.htm.
    Or alternately you can create a query that always queries only the updated record and configure the JDBC adapter which would periodiocally look the DB...
    ~SaNv...

Maybe you are looking for