JDBC Sender Update Query

Does anyone know, in case of Sender JDBC adapter, how is the below handled:
Say we have the Select Query as below:
SELECT date FROM TABNAME where FLAG = "TRUE"
and the update query as below:
UPDATE TABNAME SET FLAG = "FALSE" where FLAG = "TRUE"
How do we know whether the adapter will not update the newly added rows (between the times the Select and Update queries were executed) that were not read in the corresponding Select Query.

Hi,
We had a similar situation and following description tells you how we handled it:
1.DB Job was created and scheduled to run at regular intervals which changes the status of the records from FLAG = "TRUE" to an intermediate status, say for e.g. FLAG = "INTM".
2.Select and update statements were written as follows:
For e.g.
SELECT date FROM TABNAME where FLAG = "INTM"
UPDATE TABNAME SET FLAG = "FALSE" where FLAG = "INTM"
This solution is running in our Production environment smoothly.
Question of maintenance of these DB jobs comes into play.But its upto you to decide !!
Hope it helps !
Regards,
Sridhar

Similar Messages

  • JDBC Sender update SQL Statement Question.

    I was wondering if there is a way to have the update SQL statement line in the JDBC sender update by time stamp, this would be very helpful.  Does anyone know a method of doing this?

    In the SAP documentation of the adapter it has this example for using the update SQL statement after the query statement:
    SQL statement for query: SELECT * FROM table WHERE processed = 0;
    SQL statement for update: UPDATE table SET processed = 1 WHERE processed = 0;
    What I want is to be able to put processed = (the current date) instead of processed =1 in the update statement, like this example:
    SQL statement for query: SELECT * FROM table WHERE processed = 0;
    SQL statement for update: UPDATE table SET processed = (the current date) WHERE processed = ' ';
    I seems like you can only use a fixed value for the update statements in the JDBC Sender though, I would like to know if you can use a time stamp or variable there.

  • JDBC Sender - Select Query without Update Query

    In this case, how many times data will be polled within some minutes, if my polling interval is 1 day.
    How many messages in sxmb_moni?
    Thanks,
    Greg

    >>In this case, how many times data will be polled within some minutes, if my polling interval is 1 day.
    The communication channel executes once as soon as you activate your sender communication channel.  Now a single msg is sent to XI(with many as many rows as the select query fetches from the db).
    After that, it waits for the polling interval(in your case 24 hrs) and then executes again.
    This cycle continues. If you resart the communication channel, the cycle is disrupted and a new cycle starts.
    Hope I dont add to your confusion
    Regards,
    Jai Shankar

  • 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

  • Sender jdbc adapter - no update query

    hi ,
    i am using pi 731 single stack.
    the scenario is - PI has to pick data from view of a hana database. i am using jdbc sender for it.
    pi will not have access to update the table,only pi can read the view of database.So,PI can't use UPDATE query.
    If in jdbc sender channel ,I use SELECT query only and no UPDATE query - will it work ? what will happen if there are 100 records in the view and PI failed after fetching 43 records..will it pick from 44th record next time OR it will start from 0 again ?
    rgds

    Hi SAP PI,
    It has no sense to use the sender JDBC without update query because then always will be taken the same records.
    If you cant update the source DB you only have the choice to talk with the DB administrators that they develop for you a stored procedure that it has to do the work to get different records in every PI access.
    If the PI record process fail with impossible source database update update, the only way (afaik) is to do a PI alert and to communicate it to db sender administrators. There are another option like to store the data in a intermediate table, and so on but all possibilities that i can think now are not to enough good.
    Regards.

  • Update query not working in the JDBC sender Communication channel

    Hi,
    We are working on JDBC to File scenario. As per the configuration, XI should pick the data from SQL database every 20 secs and should update the corresponding flag. We are using subquery in the select and update statement as both header and detail tables are involved.
    Now the issue is, select query is working fine but update statement is not working as expected. It is somehow updating some other records rather than doing for the ones selected by the adapter.
    Moreover logSQLstatement is also not working. Hence we are unable to identify the records which are getting updated.
    Please advise.

    Hi Rumi,
    See Question 8. Transaction Handling (Sender) in [SAP Note 831162 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 JDBC Adapter|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=831162].
    8.  Transaction Handling (Sender)
    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. "SELECT FOR UPDATE"
    is not supported in MS SQL database. In this case please make use of an
    appropriate transaction isolation level on the database. For more details
    please contact your DB vendors.
    After, see Transaction Handling Issues in [SAP Note 1039779 - JDBC Adapter issues(Escape character,Transaction handling)|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1039779].
    Best Regards.
    Pedro Baroni

  • WHEN DOES UPDATE  HAPPEN IN JDBC SENDER Adapater

    Hi folks ,
    I am using jdbc sender adapater to call RFC function and the o/p pf the RFC i am writing to the file
    This is my select query
    SELECT * FROM ULIDTA2.F5631505 WHERE QSINTF='N'
    and mu update query is
    Update ULIDTA2.F5631505 set QSINTF='Y' where QSINTF='N'
    now the slect returns multiple rows and  i  want the rfc to be called depending on the number of rows i get 4m select . but wht is happening is i find that seleect picks the first row calls the rfc writes to the file and updates the query .
    hence other rows are not able to be processed .
    does jdbc sender update as soon as it picks the select query . how do i update one row at a time .
    thks
    amit

    Hi Amit,
    I dont think one row at a time is possible with the SELECT query as the JDBC adapter is going to return all the rows that satisfy your query.
    One work around would be to develop a Stored Procedure in your Datbase, and then use the same Stored Procedure as your select query. Now, tits the task of the stored procedure to make sure only one row is selected at a time.
    Just look at Query SQL Statement part ubnder this link,
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
    Regards,
    Bhavesh

  • DELETE Querey in JDBC SENDER

    Hello all,
    I am trying the JDBC to file Scenario. There are 5 records in a table, i can see the records in the MONI being successfully picked by the sender jdbc adapter, after being picked up i want those records to be deleted. So i write a DELETE statement in the UPDATE SQL Querey but i cannot see those records deleted from the database. i think i need to specify some COMMIT which i am not sure of, can you please provide me your suggestions for deleting records from database.
    Thanks in advance

    SAP Note if from SAP Service Market place. The link is
    https://websmp103.sap-ag.de/notes
    And the content of this SAP note is -
    <i>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.</i>
    Did you check this -
    <i>Processing can only be performed correctly when the Transaction Isolation Level is set to repeatable_read or serializable.</i>
    Regards,
    Moorthy

  • 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.

  • JDBC sender adapter - driver problems

    Hi.
    Iu2019m struggling with a little problem regarding the JDBC sender adapter, querying an Oracle database.
    Iu2019m making a simple SELECT statement, where one of the fields is of the typeu201DTIMESTAMP(0) WITH LOCAL TIMEu201D.
    Making the query in a SQL client works just fine, but in the JDBC sender adapter, it generates this error u201DError during conversion of query result to XML: java.sql.SQLException: Session Time Zone not set!u201D
    Iu2019ve searched for answers on numerous forums, and found one place, where the following where the solution:
    >>> Hi. The issue is that the driver itself needs to have a time zone
    >>> set. You have to call setSessionTimeZone() on the connection object.
    Unfortunately it is a bit hard to call this function in the adapter.
    Any of you guys have an idea what to do?
    I can add, that making a query, where no date fields are selected, works fine in the adapter.
    Regards...
    Peter

    Problem solved...
    Put a conversion (CONCAT, SUBSTR, TO_CHAR, etc.) around the date field you are about to fetch, and it works just fine.

  • Sender jdbc adapter....update query?

    Dear Team,
    we are selecting date from master database and client dont want to add any other field for update query.
    using select option, how to avoid selecting duplication records.
    can i use current date and time for selecting the records for every select statement?
    if yes then how to do it and what we need to update in update query??
    Regards,
    Chinna

    Hi Chinna,
    Check like this below.
    The following SQL statement selects the product name, and price for today from the "Products" table:
    SELECT ProductName, Price, Now() AS PerDate
    FROM Products;
    Similarly,
    UPDATE ProductName, Price, Now() AS PerDate
    FROM Products;
    Regards,
    Loordh.

  • 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

  • Sender JDBC adapter -- Update SQL statement NOT work for the last record

    I'm trying to use SAP XI to send records from Oracle database to As/400 using JDBC adapter.  I've defined the communication channel for sender
    (1)  The "Query SQL statement"  = select  a_bgn_dt,  a_end_dt from  PX_PXXD WHERE NOT CU_ACTION_CD='P' 
    (2)   The "Update SQL statement"  = update PX_PXXD set CU_ACTION_CD='P'  WHERE NOT CU_ACTION_CD='P' 
    Supposed that 3 records were retrieved from (1) and successfully updated to AS/400 but only the first 2 records in Oracle database are updated according to (2)
    Any advise.
    Pansy

    Hi Pansy,
    You select and update query is looking like wrong
    kindly check below query,If you are using oracle
    (1) The "Query SQL statement" = select a_bgn_dt, a_end_dt from PX_PXXD WHERE CU_ACTION_CD !='P'
    (2) The "Update SQL statement" = update PX_PXXD set CU_ACTION_CD='P' WHERE  CU_ACTION_CD !='P'
    Thank you
    Sateesh

  • 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, ...Processing parameters, Update SQL statement

    in JDBC sender adapter, ...Processing parameters, there is an Update SQL statement field, can u tell me ...why this is required,,,,,and in one of the example scenario...it was given as <TEST>..

    Sudheep,
    In the sender JDBC adapter you have the select query to select data from the database.
    Let us summer 2 cases,
    1. You have <test> in  the UPDATE . In this case, during every polling interval the JDBC adapter will end up selecting the same data from the Database. This would not be needed in most f the cases. Why would you want to select the same data over an over again?
    2. If you have an update Statement in the Update field you can make sure that the data selected in the selected statement is updated so that the same rows are not selected again.
    Take a look at this blog,
    /people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
    Regards
    Bhavesh

Maybe you are looking for

  • How do i remove duplicate contacts from my iphone?

    After I turned on iCloud for saving my contacts, I started see duplicates and triplicates of my contacts on my iPhone. How can I remove the the duplicates from iPhone?

  • Floating Height of JTextArea (as Renderer/Editor) in a JTable Cell

    Hey Folks, I'm kinda struggling with JTextAreas... There is this JTable, which consists of three colums (practically there are two - the other one's an ID-Field...) and only one of them ist editable für users. Left column is a commentary column which

  • In iWeb can't get past the password challenge

    I have been trying all evening to use iWeb to log in via FTP to my new Network Solutions web hosting site to upload my first web pages. I keep getting an incorrect password message from iWeb even though, using the same login credentials, I can  succe

  • Verify SCXI chassis: Configurat​ion specifies a SCXI -1600 module but nothing was detected

    Hello NI Engineer, I am using SCXI 1001 chassis with SCXI 1600 control module, SCXI 1520 signal conditioning module and SCXI 1314 connector block to acquire data from strain gage. Once I right clicked SCXI 1001 under device and Interfaces in MAX>> te

  • Adobe Photoshope Elements 6 for MAC

    The program installed fine, however when you open the program it takes up the entire viewing area of my PowerBook. There is no way to adjust the size of the program on the screen.  All three buttons, Min, Max etc  in the upper left are not visible. E