Update query in JDBC adapter
Hi guys help me with this
1) What is the use of update query in jdbc adapter?
2) Why do we use the flag field in jdbc table ?
Hi,
1) What is the use of update query in jdbc adapter?
The purpose of the Update Query in JDBC is to change the status of the processed records in the table.
That is when JDBC query is executed it select the records from the table in the Database and it sends to the Receiver.
After that it executes the Update query to change the status of the processed records in the Table.
2) Why do we use the flag field in jdbc table ?
Flag field in the table is used to identify which record is processed by Jdbc adapter. Initial stage it will have the status as 0 , if it is successfully processed then it will updated to 1.
Based on this we can identify processed records which is done by update query.
Regards
Sridhar Goli
Similar Messages
-
Not comitting database after the update query in jdbc
Hi all,
This is the first time I am posting this. I have query excuting on racle DB. This is update query. after executing the i have called commint using con.commit(). But still it is not showing the modifications in oracle db.
What could be went wrong? Any sugestion, please let me know. I think it is simple jdbc program. So i don't think i need to post the code. Application running in Unix machine.
Regards & thanks,
Nirmala Vijaya Sekhar VarreVijayTechM wrote:
Connection con = null;
Class.forName("oracle.jdbc.driver.OracleDriver");
hi all,
// following is the code
con = DriverManager.getConnection("jdbc:oracle:thin:@10.129.239.43:1529:PBILLING","BILLING","BILLING");
boolean test = con.getAutoCommit(); //here I am getting 'true'
String invoice_header_query = "update invoice_header set file_traffico = '" + zipFileName + "' where bill_ref_no = '" + billRefNo_ + "' and bill_ref_resets = '" + billRefResets_ + "' and arbor_instance_id = '" + arborID_ + "'";
System.out.println("invoice_header_query---->"+invoice_header_query);
smt = con.createStatement();
int x = stmt.executeUpdate(query); // Here x = 1 printing so it is updating the one record
// con.commit(); // Even I have tried call this method. But this will be useful when you are using the Transactioon.
Could you please tell me what went write. I am using ojdbc14.jar.
regards,
VijayPost with code tags and where is your claimed exception handling? -
Hello Everyone,
I am using a simple SELECT to fetch data from sql DB. The only SELECT it seems to fetch data is when it is getting data from sys tables. It does not work for fetching data from application tables created in the sql DB. Could this be a authorization issue? Listed below are the different SELECT statements used in PI and that works in SQL too.
1. SELECT Query : SELECT * from sys.tables
UPDATE : <TEST>
The above SELECT works and I can see all the xml messages in SXMB_MONI.
2. SELECT Query : SELECT * from sql_ztable
UPDATE : <TEST>
The above SELECT does not show any xml messages. There are records in the sql_ztable. When checking the CC monitoring I get the following message below.
Polling interval started. Length: 60.0 seconds
Processing finished successfully
Any suggestions?
Thanks,
TeresaHi Teresa,
You have to maintain the select and update statements like below.
Select statement should be like
Select * from TableName where fieldname = ''
The field name should be either status field or date field or anything. You will be having some unique field in the table. This field name will ignore the unneccesary fetching records those are already fetched.
Update statement should be like
Update TableName set fieldname = '' where filedname = ''
Here the field name should be same as the select statement filed name. What ever you have used in the filed name in the select statement you have to use same fieldname in the update fieldname.
Let me know if you have any doubts. If your issue has resolved close this thread.
Thanks,
Raju -
Hi,
i am trying to update data in database but its not getting updated.can anyone tell me the solution for this.
can i get a link which involves updating data in database.Hi,
You can use the following statement
Update SQL Statement : Update student set readflag = 'Y' where readflag = 'N'
Folloow the receiver JDBC Structure as follows
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
Regards
Seshagiri -
Providing Query statement in JDBC adapter
HI experts,
Everybody knows we can provide Query to JDBC adapter by two ways...
1st way is by constructing query as XML structure..
2nd way is by giving exact query (Select * from tablename )by SQL_query in access ...
I like to know the performance of these two ways...
Regards,
SasitharanIn XI version 3.0 there is only one way to do lookups - manually in the form of an exit in the mapping process. A user exits must be written in Java.
There are a couple of considerations about performance that must be kept in mind besides just the question of SQL Statement while implementing a database lookup using a JDBC adapter:
1. The mechanism for database lookup
There are 2 approaches Direct, Indirect
In Direct approach you poll the external table hence this may lock database for access to other users, also it is an intrusive approach. In indirect approach database table is replicated and the replicated table is accessed. The second approach is recommended for performance reasons.
2. Does the data to be looked up change frequently
If data does not change frequently than pull in data and keep a copy locally as this will improve performance
2. It is possible to access an external database from within the mapping step of XI utilizing
A. regular JDBC constructs
B. utilization of J2EE JDBC Connector
Approach 2 is recommended as it is more efficient because of Connection pools.
There is no concept or need to XML code here. The Java code that executes the lookup, would call the sql statement, this java code can be referenced from within a user-defined function in the graphical mapper or from within XSLT.
Hence you need SQL statement in J2ee JDBC Connector to get the best performance.
Refer to URL
http://searchsap.techtarget.com/tip/0,289483,sid21_gci1246926,00.html#
to understadn how to configure the JDBC Connector Service to perform database lookups
Let me know if this helps. -
Update in JDBC-Adapter (Send)
Hallo,
I´m trying to execute a Update in the JDBC-Adapter (Sender). When a Select-Statement results in exactly one entry back from the data-base I wont to Update this entry.
How refrencing to the enty (for example by an primary key)? I found only documentation for Receive-JDBC-Adapter...
Thanks in advance,
FrankHi Frank,
At last I get your scenario..
One solution to your problem can be the following though i am not sure if this is a perfect soultion or a viable solution but, it is a workaround solution which you can surely try.
1. To update the status of your database on the basis on the events that have taken place, you can configure a JDBC Adapter as a receiver.This JDBC adapter will contain the event and the flag value as well as Update condition.
Just check this blog and SAP help to understand how JDBC receiver adapter works,
/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
2. In your JDBC sender adapter that is polling over your DB table, you can give the value for UPDATE as <test>. This means that you are not changing anything even after the adapter has picked up intfo from the table. Ofcourse, you would have to increase the polling interval time as the JDBC receiver has to update the DB.
I know this solution is a long shot and an added headache but if nothing works out, you can always do it this way.
Hope this helps,
Regards,
Bhavesh. -
Xi 3.0: JDBC Adapter
Hi.
In my scenario we use a JDBC SENDER adapter where we use the UPDATE Query of the adapter to "mark" all the rows retrieved by the SELECT statement.
We noticed a very "scarying" situation: the SELECT query retrieved <b>2 rows</b>, but the UPDATE statement updated <b>3 rows</b>... and obviously both the queries have the same WHERE clause.
It seems that between the SELECT statement and the UPDATE statement a new row has been inserted...
I've always believed that the SELECT and UPDATE statement were executed within a single transaction, but after this surprise i have some doubt....
Does anybody knows if the SELECT/UPDATE of the JDBC Sender adapter run inside a transaction or not?
If not, does anybody have idea on how i can manage the coherence of the data between the selection and the update phase?
Thanks in advance.
Alessandro<b></b>Hi,
>>>Unfortunately, the solution you suggest cannot work with oracle DB (that i forgot to mention...)
I didn't know it was working on an Oracle
>>>By the way, you confirm that the select and update of the sender adapter ar not executed in a transaction????
no, they <b><u><i>should</i></u></b> run in one transaction
from SAP note:
"The SELECT and the UPDATE are run in the same DB transaction"
if you want more detalis I suggest reading:
point : 8. Transaction Handling (Sender)
from SAP note: 831162
but if you saw this 2 - 3 results then maybe you can try:
SELECT FOR UPDATE ?
but take a look at the note first ok?
Regards,
michal -
Sender JDBC Adapter with Mutiple SQL Database Tables.
Hi All,
My requirement is SQL->PI7.0->BI.
I have a plan to go with the senario like this : JDBC sender->SAPPI->ABAP Proxy.
And also I need fetch the data from more than 10 data tables with different database tables with key fields.
Could you please suggest me, How to extract all tables data to SAP PI System. Either need to go with Stored procedures or Any Join conditions or each table like as one Interface.
Please provide me your suggestions.
Regards,
ChandraHi ,
Chandra ,
Best way is Database Views
Involve a Database guy in your scenario : Tell DBA the fields required , tell DBA the PrimaryKey and ForeignKey Relation Between All your 10 Tables.
DBA will create a View for you on 10 Tables.
So in Ur SELECT Query . you can write simply
Select * from <ViewName>;
And One more thing to Tell DBA to create a UPDATABLE VIEW not only READ-ONLY View.
By this way you can way you can Update VIEW also in UPDATE QUERY of sender Adapter...
Regards
PS -
Xi JDBC Adapter - Query SQL Statement & Update SQL Statement
Hi!
I configure the JDBC adapter sender (XI) to take data from Oracle database.
I set the Query and Update SQL Statement in the Processing parameters of the communication channel in this way:
Query SQL Statement :
SELECT * FROM XI_TABLE WHERE STATUS = 'WAIT' ORDER BY ROW_NUM
Update SQL Statement :
UPDATE XI_TABLE SET STATUS = 'DONE', DATE = SYSDATE WHERE STATUS = 'WAIT'
My question is :
If a new record with the field STATUS = 'WAIT' is added to the table (xi_table) during the time between the execution of the query statement and the start of the update statement, what will happen to that record during the update?
There is a way to avoid the update of that record? or to pass to the update statement only the record selected in the query statement?
Please, may you give me some example?
Thanks,
Francescohi,
did you check "Isolation Level for Transaction"
for the sender jdbc adapter?
http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
Regards,
michal -
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 ?
rgdsHi 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. -
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,
ChinnaHi 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 row by row in Jdbc Adapter sender ?
Hi friends ,
No i am reading data from a table using select query and resulting data i am keeping in the FTP folder as XML File.
I want to
1. to know how many rows i read ?
2. Update the read completed time in each row of the sender side table .
( I am using <b>select * from a table where tag='n' </b> . I am giving this in <b>Query SQL Statement</b> of JDBC Sender adapter processing parameter .
I am writing update query as update table set tag='y' where tag='n' .
Will it perform row by row ?
3. Insert in to another R3 System table the rows which i read as a log .
Can you please give procedure to do that .
Expecting your reply asap .
Thank you
Best Regards.,
V.RangarajanHi raj ,
Thanks for ur reply . I am new to xi . Just i am doing a scenario . I can able to read the ms-sql server table data using jdbc Sender adapter .
Can i use RFC Adapter to insert the values to R3 table ?
If i have mapped to rfc fields will it store into the table once we read the data from ms_sql server table using select query of JDBC Sender Adapter ?
Best Regards
V.Rangarajan -
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 -
JDBC adapter - no UPDATE to database
Hi,
I have the scenario ABAP Proxy to XI to JDBC to read some data from a database and return some info back to BW. Is it mandatory to UPDATE the selected records in some way or can the UPDATE part of the adapter be disabled by putting something in the UPDATE parameter on the comm channel ?
Cheers
Colin.Hi Colin,
if you are talking about a sender JDBC adapter: you can put <TEST> in the update statement.
See this snippet from the help:
<i>Update SQL Statement
You have the following options:
Enter a valid SQL statement that is to be applied to the database once the data (determined from the Query SQL Statement) has been successfully sent to the Integration Server/PCK.
It must be an INSERT, UPDATE, or DELETE statement.
In place of the SQL statement, you can also enter <TEST>. Once the data determined from Query SQL Statement has been successfully sent, the data in the database remains unaltered.
This is recommended if the data has not only been read, but also changed by a stored procedure entered under Query SQL Statement.</i>
http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
If you want to synchronously call a receiver JDBC adapter, i think you can use action=SELECT without an update.
Regards
Christine -
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.
PansyHi 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
Maybe you are looking for
-
HP Phoenix 8-core - how do I get XP Mode to work in Windows 7 64-bit?
My Computer: HP Phoenix 8-core, 12 GB Ram, over 1,000GB hard drive space, Win 7 SP1 with current updates. Downloaded and installed the following: Windows XP Mode with Windows Virtual PC, the hotfix MS provided for AMD multicore, and the MS Hardwar
-
Webutil_file.create_directory & client_host
HI, *1.* I want to create directories & files in my C:\tmp, but I want try to run from my form. For example, I have a form. In my form, have a button 'Create File'. When I click that button, it will create a folder/file in my C:\tmp, not in AS. My OS
-
Webcams not working in Chrome for Ubuntu, despite having permission.
Not a too complicated issue I think: I've given my webcam permission through Flash to operate on a particular website, but it won't work anyway. For whatever reason the webcam is just not turning on. I use Google Chrome for Ubuntu 12.04 if that helps
-
I ordered a new iPod Touch, since my 4th Generation Touch is completely broken. This is the first time I've ordered an item from the Apple Store. I coughed up an extra 10 bucks to get the 2-3 day shipping--I got my name engraved into it, so that sets
-
Best practice for creating a bulk of new instances
Hi, My customer has a requirement to create a bulk of 30,000 new instances by scanning a database table (an export from a billing system) which contains a list of a call center tasks (interactive) to be performed. They will be executed throughout the