473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Transactional haywire...

Does anyone know a way to implement following scenario in a single
transaction:

From a VB application we connect to Oracle over OleDB to execute a
couple of stored procs in following way:

- Application goes to the DB as user uA executing procedure pA
- Application goes to the DB as user uB executing procedure pB
- Commit or rollback (all or nothing)

pA does a couple of things in the DB that allow pB later on to delete
data without being faced with foreing key constraints, so it's not an
option to have pA not commit because pB needs to be able to see the
results of pA while being logged to Oracle under another user account.

There are several reasons (on which I won't elaborate here) why we
can't use a single user to do the work.

Any comments appreciated.

Peter
Jul 19 '05 #1
3 1996
pe****@mail.be (Peter) wrote in message news:<79**************************@posting.google. com>...
Does anyone know a way to implement following scenario in a single
transaction:

From a VB application we connect to Oracle over OleDB to execute a
couple of stored procs in following way:

- Application goes to the DB as user uA executing procedure pA
- Application goes to the DB as user uB executing procedure pB
- Commit or rollback (all or nothing)

pA does a couple of things in the DB that allow pB later on to delete
data without being faced with foreing key constraints, so it's not an
option to have pA not commit because pB needs to be able to see the
results of pA while being logged to Oracle under another user account.

There are several reasons (on which I won't elaborate here) why we
can't use a single user to do the work.

Any comments appreciated.

Peter


Of course the answer is "you can't". But you knew that already,
didn't you? You really should elaborate on why you have to do it that
way. It might give an insight into the solution.
Jul 19 '05 #2
> Does anyone know a way to implement following scenario in a single
transaction:

From a VB application we connect to Oracle over OleDB to execute a
couple of stored procs in following way:

- Application goes to the DB as user uA executing procedure pA
- Application goes to the DB as user uB executing procedure pB
- Commit or rollback (all or nothing)

pA does a couple of things in the DB that allow pB later on to delete
data without being faced with foreing key constraints, so it's not an
option to have pA not commit because pB needs to be able to see the
results of pA while being logged to Oracle under another user account.


No way in a single transaction -- for the reason you stated yourself:
uA must commit, before uB does its stuff, because there is no way uB
und uA can share a transaction.
So, your question then translates to "How to undo a committed
transaction?"
Prior to 9i, you have no chance. In 9i and above, you may look at the
flashback query feature to show you the table(s) as they were when pA
started. This should allow you to reverse the changes if need be.
But of course this assumes that you are still in control (e.g., the
instance hasn't crashed meanwhile) after pB finishes, in which case
you probably don't want to "rollback" anyway. So sorry, bad luck -- no
automatic rollback for you.

You can design and implement some kind of homemade two-phase commit
mechanism, but you will definitely run into inconsistencies sooner or
later.
Or you can collect pA's changes instead of applying them directly, and
then have pB apply them in uB's transaction, but using uA's rights (by
calling a definer's rights stored procedure owned by uA). But I fail
to see how is that different from calling pA in uB's session.

So, in your case, I would question the reasons you don't want to
elaborate on. It's hard to imagine *valid* reasons for such a
constraint.

Have a nice day,
Flado
Jul 19 '05 #3
fl***@imail.de (Vladimir Andreev) wrote in message news:<7b**************************@posting.google. com>...
Does anyone know a way to implement following scenario in a single
transaction:

From a VB application we connect to Oracle over OleDB to execute a
couple of stored procs in following way:

- Application goes to the DB as user uA executing procedure pA
- Application goes to the DB as user uB executing procedure pB
- Commit or rollback (all or nothing)

pA does a couple of things in the DB that allow pB later on to delete
data without being faced with foreing key constraints, so it's not an
option to have pA not commit because pB needs to be able to see the
results of pA while being logged to Oracle under another user account.


No way in a single transaction -- for the reason you stated yourself:
uA must commit, before uB does its stuff, because there is no way uB
und uA can share a transaction.
So, your question then translates to "How to undo a committed
transaction?"
Prior to 9i, you have no chance. In 9i and above, you may look at the
flashback query feature to show you the table(s) as they were when pA
started. This should allow you to reverse the changes if need be.
But of course this assumes that you are still in control (e.g., the
instance hasn't crashed meanwhile) after pB finishes, in which case
you probably don't want to "rollback" anyway. So sorry, bad luck -- no
automatic rollback for you.

You can design and implement some kind of homemade two-phase commit
mechanism, but you will definitely run into inconsistencies sooner or
later.
Or you can collect pA's changes instead of applying them directly, and
then have pB apply them in uB's transaction, but using uA's rights (by
calling a definer's rights stored procedure owned by uA). But I fail
to see how is that different from calling pA in uB's session.

So, in your case, I would question the reasons you don't want to
elaborate on. It's hard to imagine *valid* reasons for such a
constraint.

Have a nice day,
Flado


Peter, if you need two separate sessions to perform work together then
I suspect you need a messaging system and a message processor.
Perhaps session-A and session-B could use dbms_pipe to send the data
to a deamon process, sessionC. Session-C could hold requests from one
session until the matching request came in from another session and
then perform the db update task. On success or failure a message is
sent to both session-A and session-B indicating success or failure.
Based on the consistency model of Oracle and without knowing more
specifics of what it is you are trying to accomplish I do not see any
way around using some kind of work coordinator process that actually
performs the database update on behalf of the user sessions.

HTH -- Mark D Powell --
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ralph Freshour | last post by:
Does anyone have any examples of using Transactional processing of MySQL with PHP? I'm not sure if the BEGIN statement needs to be in front of my SELECT statement or processed before hand by...
0
by: John Smiths | last post by:
Ha...sussed it. In my throw statement I was referencing a property of the class. It didn't like it. Thanks to all those who replied.....;>) >-----Original Message----- >I've followed...
0
by: Edward | last post by:
Here is the architecture for the Transactional Replication: SERVER1 - PUBLISHER - Also acts as back-end database for Enterprise-wide application written in VB. Uses ~430 stored procedures. ...
1
by: Pradeep | last post by:
Hi, In the Web application I am working on, data is read from a SQL Server database. At any time, there are about 15 people browsing the web. The SQL Server database is updated with new...
10
by: Rithish | last post by:
Hi folks. A premature and redundant question maybe... But I have a TABLE problem. This is almost something like what I want to acheive. ----------------------------------------- | ...
0
by: Richard | last post by:
hi, I am using SQL SERVER 2000. My query is, Can I restore my 60 transactional log file backup in one sql statement,giving condition where it is suppose to start and end.
0
by: prashant | last post by:
Hi, I am trying to set up Transactional replication with immediate updation. The configuration is as follows: 1. Publisher is SQL server 2000 Enterprise Edition, and Distributor is on the...
2
by: DickChristoph | last post by:
Hi I tried posting this query in microsoft.public.sqlserver.programming but got no response. I am new to replication but I am trying to setup up a transactional replication of tables from one...
24
by: Ian Boyd | last post by:
i accidentally ran an UPDATE statement without the WHERE clause on a customer's live customers table. After saying "oh shit" many many times, i closed the ad-hoc query tool, hoping DB2 would see my...
9
by: Michael Sparks | last post by:
Hi, I'm interested in writing a simple, minimalistic, non persistent (at this stage) software transactional memory (STM) module. The idea being it should be possible to write such a beast in a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.