--> --> --> --> -->
all
Business
Careers and Education
IT
Apache Web Server
Content Management Systems
IIS / Microsoft Internet Information Services
Mac OS X
Microsoft Windows
Networking
Unix / Linux / BSD
Development
.NET Framework
ASP / Active Server Pages
ASP.NET
Algorithms / Advanced Math
C / C++
C# / C Sharp
ColdFusion
DB2 Database
Flash / Actionscript
HTML / CSS
Java
JavaScript / Ajax / DHTML
Microsoft Access / VBA
Microsoft SQL Server
Mobile Development
MySQL Database
Oracle Database
PHP
Perl
PostgreSQL Database
Python
Ruby / Ruby on Rails
Software Development
Visual Basic .NET
Visual Basic 4 / 5 / 6
XAML / WPF / Silverlight
XML
sign up
login
new member:
Register
member login:
Email Address:
Password:
lost password
bytes > c# / c sharp > c# / c sharp questions
How to resume after an Oracle Error ORA-00054
Jawahar
Guest
Posts: n/a
#1: Nov 16 '05
All,
I have a C# application with an Oracle backend. There is a fair amount of
locking being used to prevent two users from update the same records. So we
use the Oracle FOR UPDATE NOWAIT in our SQL calls. This works fine and the
second user is not allowed to access the same record as the first user.
Currently we are using a try catch block to catch the Oracle exception
ORA-0054. Then we exit the subroutine.
I am trying to look for a way to see if I can resume the execution from the
failure point.
For example:
try
{
SQL call to DB using FOR UPDATE NOWAIT;
}
catch (System.Data.OracleClient.OracleException ex)
{
if (ex.Message.IndexOf("ORA-0054 0)
do something;
}
When I get the exception I would like to try again up to three times before
finally quitting.
Is there a way of saying RESUME (an equivalent in C#) as in VB.net. I
realize I may need a loop of some kind or counter to keep track of the number
of attempts. I would like the code to try to execute the SQL again rather
than just exiting the first time we hit ORA-0054.
Any help or suggestions are always appreciated.
Jawahar
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
#2: Nov 16 '05
re: How to resume after an Oracle Error ORA-00054
Jawahar,
There is no ay to do this (with a resume, that is). You will have to
execute in a loop, like you said. Basically, have a counter that counts
down from the number of times you want to try, as well as a flag (bool) that
indicates whether or not the operation completed. Then, cycle through the
loop while the operation was not completed, and the counter is greater than
zero.
It should be pointed out that locking rows like this will kill
scalability, and this kind of "retry" semantics will become very unwieldy
and difficult to maintain.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ***@****.*****.************.***
"Jawahar" wrote in message
news:********-****-****-****-************@*********.*** color=blue]
> All,
> I have a C# application with an Oracle backend. There is a fair amount of
> locking being used to prevent two users from update the same records. So
> we
> use the Oracle FOR UPDATE NOWAIT in our SQL calls. This works fine and the
> second user is not allowed to access the same record as the first user.
>
> Currently we are using a try catch block to catch the Oracle exception
> ORA-0054. Then we exit the subroutine.
> I am trying to look for a way to see if I can resume the execution from
> the
> failure point.
>
> For example:
> try
> {
> SQL call to DB using FOR UPDATE NOWAIT;
> }
>
> catch (System.Data.OracleClient.OracleException ex)
> {
>
> if (ex.Message.IndexOf("ORA-0054 0)
> do something;
> }
>
> When I get the exception I would like to try again up to three times
> before
> finally quitting.
> Is there a way of saying RESUME (an equivalent in C#) as in VB.net. I
> realize I may need a loop of some kind or counter to keep track of the
> number
> of attempts. I would like the code to try to execute the SQL again rather
> than just exiting the first time we hit ORA-0054.
>
> Any help or suggestions are always appreciated.
>
> Jawahar
>
>[/color]
" previous question next question "
Similar topics
I got a error when i am establish the connection between oracle and sql server ( Oracle Database answers )
ORACLE 10G R1 on SLES 9SP1 ( Oracle Database answers )
Oracle 7.3 v 9.2 client connection problems ( Oracle Database answers )
Problem with Information Integrator/Federated Datase - Oracle ( DB2 Database answers )
Oracle Adventures ( ASP.NET answers )
Javascript, ODBC, and Oracle functions returning cursors ( JavaScript / Ajax / DHTML answers )
Oracle & WinXP Pro ( Oracle Database answers )
Connecting Windows Clients to Oracle ( Oracle Database answers )
A simple Listener problem while installing Oracle by copying Ora Home ( Oracle Database answers )
migration from oracle 8i to 9i ( Oracle Database answers )
More channels
Business
IT
Development
other
forums
FAQ
Copyright 1995-2010 BYTES. All rights Reserved About Bytes Help
Latest Expert Topics Popular Tags
Sitemap C# / C Sharp Answers Sitemap C# / C Sharp Insights Sitemap