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

Similar Messages

  • Delete Operation in JDBC Sender Adapter not works

    Hi,
        I have one student table which contains the fields ID,Name,BirthMonth,BirthYear,ReadFlag fields. ReadFlag is a character field or lenght 1 which contains only values either 'Y' or ' '. 
         I want to execute delete operation in this table ie to delete the records which contains the readflag = 'Y'. So, I set the below values for the following parameters.
    DELETE FROM student WHERE READFLAG = ' Y '
    Query SQL Statement : SELECT * FROM student WHERE readflag = 'Y'
    Update SQL Statement : DELETE FROM student WHERE READFLAG = 'Y'
    Poll Interval : 60 Seconds.
        There are more records in this table which contains readflag = 'Y'. But, the Adapter does not delete those records from the table i.e delete operation is not executed. At the same time, in Comm. Channel monitoring it does not show any error, but the delete operation is not carried out in the table.
         I tried after 'COMMIT' the table also. But it does not work. What could be the reason ? or How to use Delete Operation effectively on the table ?
         Kindly help me friends to solve this problem.
    Thanking you.
    Kind Regards,
    Jeg.

    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm >>>
    <i>Adapter Work Method
    You must add an indicator that specifies the processing status of each data record in the adapter (data record processed/data record not processed) to the database table.
    The UPDATE statement must alter exactly those data records that have been selected by the SELECT statement. You can ensure this is the case by using an identical WHERE clause. (See Processing Parameters, SQL Statement for Query, and SQL Statement for Update below).
    <b>Processing can only be performed correctly when the isolation level for transaction is set to repeatable_read or serializable.
    Example
    SQL statement for query: SELECT * FROM table WHERE processed = 0;
    SQL statement for update: UPDATE table SET processed = 1 WHERE processed = 0;
    processed is the indicator in the database.</b></i>
    try with repeatable_read or serializable !!!
    Also go thru this thread - DELETE Querey in JDBC SENDER

  • 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 Communication channel stop working

    Hi all,
    I'm facing with a strange problem: I have a db to db scenario (SQL server to Oracle) that has been tested and that was working properly.
    But when we started again our tests after some days, without doing any change, the flow didn't start anymore. The problem is in the sender jdbc communication channel:
    creating it again with a NEW NAME, and changing the configuration the flow starts again. I try to explain the checks that I did:
    - from the runtime workbench the adapter looks ok: green and making polling to the db (obviously without select any record even if we were sure that the select condition was satisfied by some records).
    - I tried to simulate some changes re-activating the communication channel.
    - clear cache
    Nothing was working,the only solution was to re-create the cc with a new name (deleting the old one and creating a new one with the same name is not working as well). But we cannot consider this solution in a production system.
    I have several scenarios like this and this problem happened three times in some months and every time with the jdbc sender from SQL server (never with the sender from Oracle).
    There is someone that has any suggestion?
    Thanks in advance,
    Luciana Agostini

    Hi Luciana,
    There is nothing that you could do in PI that could help because most of the places where there could be a problem like cache or with adapter statuses you have already looked into . For the sake of a second opinion see what prateek srivastava has to say.
    Basically a n/w connection problem or at the SQL db level.
    Rgds
    joel

  • JDBC sender channel running but not picking up the data from sp

    Hi,
    One of the jdbc sender channels in production is running at its schedule time but it is not picking up the data from the sql side, we have checked with the sp side and they are saying that sp is running fine. No changes have been done in its configuration. Last message coming in RWB  is Retry interval started but that is of 1 day and its already been 3 days. I tried by starting and stopping the channel but of no use. The channel was re activated but that also didn't help.
    Please help, what can be the reason for the same.
    thanks.

    Hi,
    The JDBCadapter ( The respective channel) is definitely locked in PI . Ideally for each polling interval a lock is being created and once the processing is over , the lock should be released/deleted automatically to allow further polling interval. If the lock is not released by the system automatically,further polling will not happen as expected. ( This may affect all sender JDBC adapters as well. I would recommend to do a check in all sender JDBC communication channels)
    You can see/delete the locks in Visual admin.
    Go to Server>Services->Locking adapter and click refresh
    The entries for JDBC adapter ( with name $XIDBAD.JDBC2XI) should be deleted by selecting those particilar entries and click delete selected locks.
    If you have more than one node, then same should be done in all server nodes.
    The temprory solution would be creating/copy the existing channel in ID with same properties and assign it into particular sender agreement.
    But, the lock may be created again which potentailly stops all your database interfaces. Hence i would suggest to use Disconnect From Database After processing of Each messages in Advanced tab in the sender JDBC adapter.
    Hope this solves your issue.
    PS: The same bahaviour would expected for all file adapter as well

  • JDBC Sender adapter question

    Hi,
    Scenario: JDBC-XI-R/3
    I am trying to run the JDBC sender adapter every 3 minutes based on the poll interval to select rows from Oracle db.
    In the select and update statements when I use the rownum < '11' and flag condition (Y or N), then I see XI is picking up 10 rows in a two times and I see two parallel processes in SXMB_MONI.
    I want XI to run only pickup 10 rows for every 3 minutes and update only 10 rows in Oracle to "N" from "Y".
    When I take out the rownum condition from update I do not see this issue.
    <u>Update statement:</u>
    Update <TABLE> set status_flag = 'N' WHERE status_flag = 'Y' and rownum < '11'.
    Can some body point me in the right direction ?
    Thanks
    Steve

    Hi there,
    See if this works. Though I never came across such a scenario, I can think what to be done in this case.
    Create a staging table as same structure as from where our JDBC adapter is picking up the data currently.
    Whrite a tigger(after delete) on staging table to call a stored procedure.
    stored procedure will select the data from source table and insert them in to staging table (rownum<11) as well as update the flag column in source table.
    Now load the staging table initially from source table with only 10 rows (one time process). Configure your JDBC adapter on staging table. In update sqlquery field of JDBC adapter write delete statement for all the data from staging table to be purged, as there will not be more than 10 rows at any time and after each time the adapter supplied Delete statement will purge the data so you dont have to worry about selecting 10 rows or updating 10 rows from JDBC adapter. As every time the trigger after delete statement will fire and load only 10 rows from source marking those 10 rows as read_already status.
    NOTE: for Calling stored procedure from trigger follow your database SQL reference documentation.
    Thanks.
    -Nilkanth.

  • How to cofigure the JDBC Sender adaptor

    how to cofigure the JDBC Sender adaptor,
    i want to do the scenario JDBC>XI>SAP
    Thanks & Regards,
    priya reddy

    HI
    Database (JDBC) Adapter
    The JDBC Adapter allows access to any DB that allows a JDBC driver to access the DB. This driver is not supplied with the adapter but must come from the DB provider or a 3rd party. The adapter converts database content to XML and vice versa.
    Database content can be read with any SQL statement using a special XML format. This format enables SQL INSERT, UPDATE, SELECT, DELETE or even stored procedures. A message is always processed in one database transaction.
    Refer the following links for further assistance
    JDBC ADAPTER:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/1d/756b3c0d592c7fe10000000a11405a/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/frameset.htm
    Use thes step by step guidese
    https://wiki.sdn.sap.com/wiki/display/XI/JDBCTOJDBC
    https://wiki.sdn.sap.com/wiki/display/XI/XMLFile2XMLFile
    tutorial /people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
    http://help.sap.com/saphelp_nw2004s/helpdata/en/1d/756b3c0d592c7fe10000000a11405a/frameset.htm for sender side JDBC configuration.
    Follow this link
    /people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
    cheers
    reward points if found useful

  • Only JDBC-sender channel

    Hi Experts,
    the scenario is as following:
    i have a database, i want to delete some entries with 2 where conditions ...
    why do i have to create a huge scenario with 2 async messages jdbc sender for polling and receiver for deleting...
    with the sender i can use the update statement .. why cant i use him standalone .. like every 60 seconds delete the entries..
    thanks for your help

    Hi,
    > why isnt it possible to activate only the sender .. ?
    I would say the aim of PI is to transfer messages from system A to system B.
    In your scenario you only have system A and you don't want to transfer any message.
    So maybe PI is the wrong tool for your requirement.
    But if you still want to use it perhaps this blog helps a little bit:
    How to send any data (even binary) through XI, without using the Integration Repository
    Regards
    Patrick

  • Tigger jdbc sender

    Hello All,
    I have JDBC-RFC Scenario.
    My requirement is like whenever any changes are made in oracle database (insert, update, delete), immediately it should send data to RFC. I need real time scenario. i don't have direct access to DB
    Is there any way to do that?
    In one of thread i have read that we can receive a SOAP trigger message from db using primary key and the use web service to get details is possible. In this case i don't need to have access to DB.
    If that is possible can anyone tell me how to do that
    Please guide me for the same.
    Regards,
    Manisha.

    Hi Manisha,
    Yours is a very interesting requirement . I don't think such a functionality is possible against a jdbc adapter but with a soap it might be possible. The idea being like suppose if you are using SQL 2005 you can use a CLR based stored proc to call into a .NET web-service.
    For further help refer the thread.
    http://www.windows-tech.info/15/8be468c6c49fcb5e.php
    Regards
    joel
    Edited by: joel trinidade on Mar 24, 2009 10:06 AM

  • JDBC Sender to JDBC Receiver || Acknowledgement

    Hi Experts,
    the scenario is the following:
    JDBC sender to poll a database and receive data from table a (Query SQL Statement)
    after the mapping, a JDBC receiver inserts the resultset from a into table b.
    okay, so far, now the action is done and the sender adapter has to delete the resultset from table a (with the Update SQL Statement)
    the problem is now how to ensure that only the resultset is deleted from a IF its really inserted into b? means: how to tell any adapter that the update-command is only done when the insert worked correctly?
    thanks in advance
    Chris

    First of all, u will have to make an async call from JDBC. The scenario wouldn't be that good in design :).
    The only thing to be taken care should be the poll interval. It should be large enough so that the BPM processing is complete otherwise the polling of same data will occur twice. (U may use Planning Availability Times concept here).
    I understand that the UPDATE statement is mandatory
    U can write Test to just don't update anything.
    Now the data would be sent to receiver and after the successful receipt at receiver, BPM send step would be triggered with the update statement to actually update the table.
    Hope it makes everything clear
    Regards,
    Prateek

  • JDBC Sender - Wrong SELECT statement (Oracle driver)

    Hi,
    3 days ago I was having a problem with my JDBC Sender adapter [JDBC Sender adapter is reading but then there isn't the message in SXMB_MON; .
    Finally I discovered what's wrong but I can't understant why is not working. When I deleted the "WHERE" condition in my SELECT statement all worked OK (except that I need the WHERE statement...).
    Why that statement is not working in my JDBC Sender:
    SELECT * FROM MATERIALES WHERE LEIDO<>'X'
    and that statement works:
    SELECT * FROM MATERIALES
    The field "LEIDO" is my flag that I must set to X when I read with the UPDATE statement, so I need the where condition...

    Thanks Christopher but still not working
    I tried two new statements:
    1 - Escaping:    SELECT * FROM MATERIALES WHERE LEIDO <> 'X'
    2 - Changing the operator symbol: SELECT * FROM MATERIALES WHERE LEIDO != 'X'
    The nº1 gives me an error of invalid character
    The nº2 has the same effect than the other symbol, the adapter reads from the DB but no XML message is generated and no payload to check what's happening... just a message ID without information and without a message generated in SXMB_MONI

  • 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

  • Avoid JDBC sender error: Execute statement did not return a result set

    Hi!
    My JDBC sender adapter towards MS SQL server works fine, with an Execute statement calling a stored procedure that returns the source data needed. The stored procedure itself updates the status of database table records, so that only the unread records are returned each time the stored procedure is called.
    However, the communication channel monitoring sets a red flag for the JDBC sender adapter, when there are no values to fetch from the database table (using the stored procedure). Message says: "Database-level error reported by JDBC driver while executing statement 'EXECUTE FetchMessage 1, 9000'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor."
    This is not an error situation, as I do not expect there to be any values to fetch from the database at all times.
    I do not see how to change the stored procedure to avoid this error.
    Is there a parameter to be set on the JDBC adapter that I can use, so the red flag is avoided?
    Thanks for any input!
    Regards,
    Oeystein Emhjellen

    Hi Oeystein Emhjellen.
    The problem is Store Procedure that has to generate always a ResultSet (or cursor). If it doesn't have a output, you have to generate an Empty ResultSet.
    Like a SELECT Statement:
    If there are data, SELECT get an output result but if it get nothing the SELECT Statement get a empty ResultSet.
    Ask to your database team.
    I hope it helps you.
    Bruno.

  • Stuck with logical system name for JDBC Sender system!!!!!!!!!!!!!

    Hi All,
    I'm doing a scenario as JDBC2FILE.
    I tried to add my jdbc sender system to SLD. So i created the technical system
    now i'm creating business system...what should i give at logical system name tab? I've created tech system and business system as third party.
    do we need logical system name in this scenario where we are not interacting with any R/3???
    can anyone suggest the way to achieve this scenario?
    Thanks in advance.....
    Santhosh.

    Hi Santhosh,
    I just want to add ons..few more information which it might help you.
      You no need to give logical system when you are using Thirdpaty.
    Please check the below blog you will get more idea how to proceed to achieve the JDBC Scenario.
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
    If you have any doubts while proceeding with your scenario plesae let me know..I will try my level best.
    Thanks and Regards,
    Chandu

Maybe you are looking for