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
Similar Messages
-
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: 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
ChrisStefan 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. -
JDBC sender adapter provides incomplete data
Hi,
I have a JDBC sender adapter which reads data from a MySQL table, and passes it to a proxy which writes the data then in a SAP table.
- Query SQL statement = SELECT Field1, Field2, Field3, Field4 FROM jdbctest WHERE Processed = 'N'
- Update SQL statement = UPDATE jdbctest SET Processed='Y' WHERE Processed='N'
I did a stress test with a program that writes data simultaneously to the MySQL table (up to 10000 records), and the JDBC sender adapter which checks the table every 15 seconds.
At the end, my SAP table contained only 9965 records.
This means that probably there have been records added between the Query and the Update statement (So they haven't been read, but their status is changed).
Does anyone have a solution for this?
Best regards,
Nicolas De CorteHello Dharamveer,
I don't really understand your answer.
My point is that the JDBC adapter only processed 9965 records out of 10000, but it updated all 10000.
So now in my MySQL table there are 10000 records with status Processed, but only 9965 have been really processed. And I think this is because records have been added between the execution of query and the update statement. -
HI Friends,
I have configured the JDBC Sender Adapter with parameters as
Driver : oracle.jdbc.driver.OracleDriver
Connection : jdbc:oracle:thin:system:netweaver:@172.25.4.221:1521
But Iam getting an error in Componenet Monitoring:
<b>History:
- 2006-05-30 04:55:36 UTC: Error: Stopped unexpectedly - reconfigure and activate to continue processing. Error: java.lang.NullPointerException
- 2006-05-30 04:55:36 UTC: Processing started</b>
How to resolve this??
Regards,
RajuHi
Thanks for the reply.
I tried with <b>jdbc:oracle:thin:@172.25.4.221:1521:netweaver</b> and
<b>jdbc:oracle:thin:@172.25.4.221:1521:system</b>
Now Iam getting another error.
<b>Sender Adapter v2108 for Party '', Service 'TBIT40_XI_LEGACY_BS_04':
Configured at 2006-05-30 05:12:30 UTC
History:
- 2006-05-30 05:13:00 UTC: Retry interval started. Length: 20.000 s
- 2006-05-30 05:13:00 UTC: Error: Accessing database connection 'jdbc:oracle:thin:@172.25.4.221:1521:system' failed: DriverManagerException: Cannot establish connection to URL 'jdbc:oracle:thin:@172.25.4.221:1521:system': SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153093376)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
- 2006-05-30 05:13:00 UTC: Processing started</b>
Can U please solve it..
regards,
Raju -
Update sql statement in sender/receiver jdbc adapter
Hi
What is the update sql statement we give in the sender/ receiver adapter when
1) SELECT statement was written in query sql statement
2) EXECUTE statement was written for a stored procedure in query sql statement
thanks
Anitha> 1) SELECT statement was written in query sql statement
your table should have some value "already_processed" which prevents a second processing of that table.
the update statement sets that value.
> 2) EXECUTE statement was written for a stored procedure in query sql statement
the same as above.
when your stored procedure already does the update, then write a second stored procedure which does nothing. -
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 -
Sender JDBC adapter : Update SQL Statement : stored procedure
Hi,
Can we use a stored procedure in the sender jdbc adapter in 'Update SQL Statement'.
The problem i am facing is like, we are selecting data from two tables in 'SQL statement for query' and then in 'Update SQL Statement' , we need to delete that data from these two tables.
Please let me know if it is possible.
Thanks,
Rohityou can use a Stored procedure in the
Query SQL Statement
You have the following options:
· Specify a valid SQL SELECT statement to select the data to be sent from the specified database.
· Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs.
so have your whole select and update as part of this single Stored procedure -
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 -
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 Adapter, Update statement
Hi ALL,
I have a JDBC to proxy scenario. We have stored procedure in the database that executess and sends the data to SAP.
Also the same store procedure updates the field Status_ID to distinguish between read and unread records. Status_ID acts as a Flag.
Now because the Stored procedure itself does what 'Update SQL Statement' in sender JDBC adapter does, what shall I put in 'Update SQL Statement' as it is not needed, but it's a mandatory field??
XIer
Message was edited by:
XIerDo you need that update in the sender jdbc adaptor to do anything....?
Dint think so..
Change your update statement to update Status_ID if its not updated..and if the sql procedure has run already then its not going to be updated ..as it already is.......
Regards
Ravi Raman -
Update SQL Statement in the JDBC sender
Hello!
I have a AS400/DB2 table which I am polling for my XI scenario using the JDBC sender adapter.
I would like to know if it is possible to use system variables (data/time) in the UPDATE statement field? This because we would like to timestamp the exact date/time we read a table. (We can use stored procedures, I know, but would preferr not if at all possible.) Or is there another way?
Thanks,
NamHello!
a little more detail:
We have a fairly simple scenario. We are polling the AS400/DB2 table for information using the JDBC sender with a SELECT statement in the SQL query. We take the data, map it and push it into SRM.
Bhavesh: What I meant is that for error handlig purposes we would like to update the polled record with date and time at the same time as we poll. Using the system date/time of the db system would be ideal, but XI time would be just fine to. So wondering if there is any way to pick up the system data/time (of either system) and pass it in the UPDATE statement as system variables or some such.
Nimrod: one question.... how do we do the mapping in the poll? Meaning the polling is the trigger of the whole scenario, so there is no mapping preceding it. I am fairly new to XI, especially the mapping bit, any help or advice appreciated!
Thanks!
Nam -
Update SQL statement in JDBC sender (system fields)
All,
Is it possible to update more than 1 field via the update sql statement ?
Also, is it possible to use system fields ?
Something like this
UPDATE database.table SET processed='Y', date = sy-datum
Regards, MichelHi
use sysdate as suggested above
Check your generated SQL query format is correct
At runtime you can find the genereated sql statements by doing configuraitons in Receiver JDBC adapter.
In the JDBC Receiver adapter you have the Advanced Properties .
Over there enter the following
left column logSQLStatement
right column true
To see the query created ..
Login to adapter monitoring ..select the relevant jdbc adapter.
Now when any message is processed by the jdbc adapter in adapter monitoring at that time you will see a message link. When you click on that link a new window will open. In that window if you click on page down you will get to see the sql statement generated by the jdbc adapter. -
JDBC Sender Adapter - SQL-Statement
Hi,
I'm using the JDBC-Sender-Adapter and need to use a SQL-Statement like this:
SELECT * FROM myTable WHERE myDate = <current_date>
Is such a dynamic-sql possible, or can I only use static sql-statements. And if yes how can I solve this problem.
many thxHi Werner,
inside the <b>Query SQL Statement</b> you can use <b>SQL EXECUTE</b>
which can execute a stored procedure
in which you can do
SELECT * FROM myTable WHERE myDate = <current_date>
http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a> -
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,
SuvarnaHi,
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
Maybe you are looking for
-
When creating a fillable PDF form can I add a password to only selected fields?
I am creating a fillable form which will require data entry from several different people before being returned to my office. There are certain fields on the form that need to be restricted to personnel in my office only. I have tried to accomplish t
-
Java.lang.NullPointerException in MQ adapter in Production Environment
Hi, My Process like Send the request to ResultsAAA or ResultsBBB (MQ queue) and Dequeue the msg req from the queue(ResultsAAA OR ResultsBBB) basing on the request request goes to either ResultsAAA or ResultsBBB and executing the bpel and we are confi
-
Configure PHP Server: Why Can't I Create a Folder in the Web Root?
Hi, I'm trying to create a new Flex 3 app with PHP as the application server type. I'm running: Flex 3.2, MAMP, Zend, PHP on an iMac with OS X 10.5.8. Unfortunately, Flex won't let me validate my configuration. a) I created a folder in htdocs called
-
Snow Leopared overwrite on crashing FCP
I'm having a problem where my comp goes to sleep and won't wake up when running FCP7 and my Compressor droplets are just hanging and not responding. I spoke with the Apple Pro-Apps guy ( he said he's not allowed to talk about FCP7 but would help me
-
Confirmation issues, Error in Process
We are getting the following error in SRM system when doing confirmations, any ideas guys Error whilst creating an entry sheet in the backend system 0000026433 117 General error during acceptance posting This then dispays as an error in process??? Re