SAP XI JDBC update SQL statement
Hi,
I am new to JDBC to RFC configuration and is currently on a deadlock.
We are running a real time JDBC update statement where records are created based on employee login. We have configured the sender adapter to retrieved 5 records for every 5 seconds using the SQL query below:
select * from dtable where uploaded=false order by recordno asc limit 5;
and update using:
update dtable set uploaded=true where uploaded=false order by recordno asc limit 5;
The problem is that when there are only 3 records retrieved in the selection, the update statement always update 5 records back. This makes records created in-between the select and update to be updated as well.
Can anyone suggest the correct update statement? Can I use the record numbers retrieved from the first statement in the update?
Thanks,
Ryan
Hi,
>>>>Can anyone suggest the correct update statement?
1. you have a few choices but one of them would be to use a stored procedure in the select statement (which would have both select and update statements)
2.
a) select * from dtable where uploaded=false order by recordno
b) update dtable set uploaded=true where uploaded=false
c) split them by 5 rows in the mapping (multimapping)
Regards,
Michal Krawczyk
Similar Messages
-
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 -- 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 -
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. -
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 -
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 -
JDBC Adapter - Update SQL Statement - Timestamp
Hi All,
I'm using a JDBC Sender channel to bring information from a database, when I bring the data I want to UPDATE a field inserting the date and time (timestamp) when you got the info.
Sender Communication Channel: JDBC
Query SQL Statement: SELECT * FROM PI_Factory
Update SQL Statement: ????????
Could you tell me how to do this?Hi
please try the below query in Update sql statement
update table_name set fieldname = systimestamp where .....
or
update table_name set fieldname = current_timestamp where .....
Regards
Ramg. -
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. -
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. -
Query SQL Statement & Update SQL Statement
Hi!
I configure the JDBC adapter sender (XI) to take data from MSSQL database.
I have to run select like this:
SELECT
tblMilestone.Site,
tblMilestone.Revision,
tblMilestone.MilestoneNameID,
tblMilestone.ApprovedDate,
tblMilestoneName.MilestoneName
FROM
tblMilestoneName
INNER JOIN tblMilestone ON tblMilestoneName.MilestoneNameID = tblMilestone.MilestoneNameID
WHERE tblMilestone.StatusCode = 1;
My question is what "Update SQL Statement" I should use in communication channel definition? I only need to update tblMilestone or this two tables?
Maybe you give me some example.Check this from SAP help...
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. -
Update SQL statement, date possibilities
All,
Is it possible to format the date in the update sql statement of the sender JDBC adapter ?
the statement curdate() returns the date in this format 09-02-04.
But, I would like to have it in this format 20090204.
this is my update statement
UPDATE table SET status = 'X', date = curdate()
Anybody knows how to do this or via something else than curdate()
MichelHi Michel,
I am sorry i misunderstood the question.. how are you getting the data from curdate() may i ask. What exactly is curdate()?
Is it a field in the database that you are retrieving?
What you could do is create another dummy field and maitain the current date in that field, in the format you want it to. Then you could use that field in the update statement as tableName.fieldName.
Use this to manage your date checks. Only that you would have to modify the date in the database every day.
Regards,
Kshitij
Edited by: Kshitij Sharma on Feb 4, 2009 9:31 AM
Edited by: Kshitij Sharma on Feb 4, 2009 9:36 AM -
Failed to post data to database during "Update": SQL Statement
Hi,
I'm getting this error while trying to update a VO via BCBrowser or UI.
Failed to post data to database during "Update": SQL Statement
This is a simple & straight forward default VO created on Entity Object (Database Table)
On the same table & with same DB credentials, I could successfully update the record.
Any Guess, on what went Wrong??
Thanks in Advance for any help.
p.s Jdev 11.1.1.6
Log:
oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Update": SQL Statement "BEGIN UPDATE CAR CarEO SET SEL_ITEM=:1 WHERE TXN_NO=:2 AND LOGID=:3 AND SEQNO=:4 RETURNING DELIVERY_MODE, CERTIFICATION_REQ, SOFT_COPY_IND, SELITEM INTO :5, :6, :7, :8; END;".
at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:583)
at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:8575)
at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:6816)
at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:3290)
at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:3093)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2097)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2378)
at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1615)
at oracle.adf.model.binding.DCDataControl.callCommitTransaction(DCDataControl.java:1417)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1437)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2150)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:740)
at oracle.jbo.uicli.jui.JUActionBinding.actionPerformed(JUActionBinding.java:193)
at oracle.jbo.uicli.controls.JUNavigationBar.doAction(JUNavigationBar.java:412)
at oracle.jbo.jbotester.NavigationBar.doAction(NavigationBar.java:111)
at oracle.jbo.uicli.controls.JUNavigationBar$NavButton.actionPerformed(JUNavigationBar.java:118)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.sql.SQLException: Invalid column type
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterInternal(OracleCallableStatement.java:150)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:399)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:581)
at oracle.jdbc.driver.OracleCallableStatementWrapper.registerOutParameter(OracleCallableStatementWrapper.java:1765)
at oracle.jbo.server.OracleSQLBuilderImpl.bindUpdateStatement(OracleSQLBuilderImpl.java:2243)
at oracle.jbo.server.EntityImpl.bindDMLStatement(EntityImpl.java:10524)
at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:412)
... 52 moreThe issue is resolved now.
new Columns added to the Database table, after creating Entity Object. These latest changes were not picked up in Entity Object.
I found this difference after comparison of entity object with DB Table.
And when I added those new columns to EO & VO, I'm not getting this error anymore.
Thanks to all who tried to help -
How to retrieve first update SQL statement initiator (locking)
Hi!
i have a table called as
test ( A number, B varchar2(10));
1) inserted 1000 records
2) update test set A=A where A=1;
3) open new session issue update test set B=B where A=1;
reselt lock;
opened again a new session and issued this statement
COLUMN blocker format a15
COLUMN blockee format a15
SELECT (SELECT username || '.' || a.SID FROM v$session
WHERE SID = a.SID ) blocker, ' is blocking ',
(SELECT username || '.' || b.SID FROM v$session
WHERE SID = b.SID ) blockee, ' from executing: ',
(SELECT sql_text FROM sys.V_$SQL
WHERE address =
(SELECT sql_address FROM v$session WHERE SID = b.SID ) )
FROM v$lock a, v$lock b
WHERE a.BLOCK = 1 AND b.request > 0 AND a.id1 = b.id1 AND a.id2 = b.id2;
Result as:-
BLOCKER 'ISBLOCKING' BLOCKEE 'FROMEXECUTING:'
(SELECTSQL_TEXTFROMSYS.V_$SQLWHEREADDRESS=(SELECTSQL_ADDRESSFROMV$SESSIONWHERESI
SYS.159 is blocking SYS.144 from executing:
UPDATE TEST SET B=B WHERE A=1
question is how can i retrieve my first update sql statement i:e (initiator)....?
as (UPDATE TEST SET A=A WHERE A=1;)
Regards,Since releasing 10.2.0.1 several years ago Oracle has released patches to 10.2.0.2, 10.2.0.3, and 10.2.0.4. I would highly recommend you read the patch notes and get your system current.
I note that you did not answer my two follow-up questions leading me to assume you do not have the license to look at the tables and views supporting ASH and AWR. Without them I do not believe you can retrieve the information you seek.
I no longer have 10gR2 on my laptop so I am not sure but take a look at gv$session.
Do you have columns named "BLOCKING_SESSION_STATUS", "BLOCKING_INSTANCE" and "BLOCKING_SESSION"? If you do that might lead you to a way you could track it down via gv$sql. -
Using Toplink to generate UPDATE sql statements?
I have a need to generate a UPDATE sql statement.
This statement will run at startup and will not effect the cache, as no objects will be loaded prior to this command running.
I realize that I can execute arbitrary SQL using Session, however, I have the additional requirement that this UPDATE is compatible with the DB it is running on.
So, I want to use TopLink to generate an UPDATE statment perhaps using the query framework. Is this possible? Is there any way to use TopLink's ability to create SQL before passing this into a Session for execution?In the current versions your only option is to provide the UPDATE SQL directly using the executeCall(new SQLCall("UPDATE ...")).
In 10.1.3 there exists an UpdateAllQuery intended to do such batch update calls. It will additionally invalidate any cached objects if they were to exist.
Doug -
hello friend ,
my xi-content scenario is oracle -> xi ->sapr/3
i am getting erro message in adapter monitor as following
Sender Adapter v0915 for Party '', Service 'oracle':
Configured at 04:26:46 2006-04-03
Last message processing started 05:17:12 2006-04-03
Error: SQLException during update 'TEST': java.sql.SQLException: ORA-00900: invalid SQL statement
last retry interval started 05:17:12 2006-04-03
length 60,000 secs
but update sql query is running fine on DB. still i am getting invalid SQL statement .
no message in sxmb_moni.
how should i check my jdbc adapter is running fine if it fine then what is error .
thanks friends.
amit ranjanAmit,
You are using a sender JDBC adapter. There are 2 SQL querries you write in a sender adapter(JDBC).
1. Select querry which selects the fields and fetch it to your XI server.
2. Update SQL. This is a crucial one coz you can not process same set of rows again and again. So you may want to maintain a flag. This happens here.
In your case update SQL querry does not seem to work.
Check it.
For more help post us the 2 querries(select & update).
Look into this link for info on config of sender JDBC adapter
http://help.sap.com/saphelp_nw2004s/helpdata/en/ae/d03341771b4c0de10000000a1550b0/frameset.htm
<i>(P.S: Reward replies that are helpful)</i>
Regards,
Jai Shankar.
Maybe you are looking for
-
AE and USB Print / Scan / Copy with HP PSC-2410
My Airport Express finds my HP printer immediately upon plugging the printer into the AE USB port. Printing to it from various macs around the house has been wonderful...but...In order to use the HP's other functions, such as scanning and copying, it
-
I've used DW pagination quite extensively and now google's index is full of hundreds of pagination urls in the format: http://www.domain.com/blog/index.php?pageNum_stuff=1&totalRows_stuff=250 I don't think this is doing my ranking any favours. What c
-
IOS 6 - Ghost email notifications
Hi I have a new iphone 5 with ios 6 etc. Occasionally I get a mail notification in the lock screen that: a) shows a preview even though previews are switched off, and b) Is for a mail that doesnt appear in my inbox. I'm not sure if these relate to ol
-
Cisco 3560-G Username/password recovery
Evening all, whilst configuring a 3560-G i was interupted whilst setting a username and password, unfortantly when i turned back around I was kicked out. it is now asking for a username even though i havent set one fully. i was vty into the device an
-
Unable to schedule CR based on BW query after newer transports
Hi We have update the integration kit for SAP tranports on BW server as below, Content Administration transport (K900645.r21 and R900645.r21) Personalization transport (K900646.r21 and R900646.r21) MDX Query Connectivity transport (K900643.r21 and R9