473,698 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help ... Rollback Transaction

4 New Member
I am new to db2 and want to know more about rollback and exception handling....
I am using AS/400 operations navigator to write the stored procedures.

I am trying this by using SAVEPOING and ROLLBACK but no luck... please help me out.....
Declare exit handler for sqlexception set nerror = sqlcode;
insert into empmaster (empname) values('test');
set emp_id = identity_val_lo cal();
savepoint a on rollback retain cursors;
insert into empdetails (empid, empaddress) values(emp_id,' add');
savepoint b on rollback retain cursors;
if nerror != 0 then

rollback to savepoint a;
end if;

I am calling the stored procedures from Java like
ex: CALL save_data('dd', 'ddd')
Jan 28 '08 #1
1 3151
sakumar9
127 Recognized Expert New Member
Try these links:

http://publib.boulder. ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw .apdv.java.doc/doc/cjvjdsvp.html

http://publib.boulder. ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw .sql.ref.doc/doc/r0003271.html
Feb 1 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2943
by: Alice | last post by:
Hi all, I have a problem with rollback segment. I am a beginner and do not have much knowledge of DBA. Anyways, the problem is there is a transaction of around 105 MB. This would not fit into the normal rollbacks created and gave an error of "maxextents for rollback reached", so our DBA created a rollback of 500 MB and I used this rollback for the transaction by using the "set transaction" command. But even then the error continued....
3
4922
by: timmy_dale12 | last post by:
Hello Im am a sql newbie who has a question concerning triggers. Ive made this trigger: create trigger check_if_already_exists on users for insert ,update as begin begin transaction
1
1676
by: Attiq ur Rehman | last post by:
Hello All, I'm trying to write a stored procedure which tracks the insert event in a Table A. When we insert something in Table A in Database 'FMDB', it inserts the same information in Table B in Database 'Wartung'. When I insert something with insert query visa SQL Query analyzer, it works fine. If i insert records via my C++ programme, it gives error that
3
1600
by: Simon Harvey | last post by:
Hi everyone, I'm having a problem that I don't know how to sort. I am trying to execute a number of SQL stored procedures in a single transaction. However it always throughs an exception saying that the "Thread was being aborted" I really need to be able to execute these procedures in a single transaction so that the data doesnt become corrupt.
2
2804
by: mahajan.sanjeev | last post by:
Hi, I am having problems with rollback using the SQLTransaction object. I am trying to insert records in two tables in a transaction. I want to rollback all the changes if any exception occurs in any of the inserts. But the SQLTransaction object only rolls back the inserts that happen before an exception. All inserts after the exception go through. What am I doing wrong? Is it that I cannot do any more Inserts using the transaction...
2
2017
by: Richard | last post by:
Hi, I have 1 dataset with 2 tables (Table1 as parent, Table2 as Child), 1 row in both the tables. I am updating it with a transaction. First parent then child. When child update fails, it raise an exception, and rollback the parent update. But it also change the rowstate of the parent row from Added to unchanged When you try to save again parent row never get created in database. So child update will fail again. Please suggest what am I...
1
3013
by: jacob.miles | last post by:
Hello. I'm trying to wrap a function call in a transaction, but when I intentionally throw an exception in the middle of the function it doesn't actually roll back the transaction. The debug output says 1/ROLLBACK, without any 1/COMMITs in there, but when I view the data in the command-line mysql utility the changes have been made. This is the code I'm using to connect to the mysql database and to wrap the function call in a...
7
9707
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason for this being to stop the user thinking the application has frozen when in fact it is just waiting for a long SP to complete. Another reason for doing it like this is that I also have had a problem in the past where the SP takes longer than the...
7
1622
by: Rich | last post by:
Hello, I have an SP that inserts data into a sqlserver table. If a condition is not met within the SP after the data has been inserted into the table, the SP will rollback the insert. If I were to write the same procedure as inline sql in a VB2005 app cmd.CommandText = "Insert Into tbl1 Values(' & txt1.Text & ')" ....
2
10800
by: Ian Boyd | last post by:
We're encountering a situation where we're encountering a deadlock, and someone's been made the deadlock victim. But after that, DB2 refuses to run any SQL, and instead we get the error message: "Application must execute a rollback. The unit of work has already been rolled back in the database but other resource managers involved in this unit of work might not. To ensure integrity of this application, all SQL requests will be rejected...
0
8603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8893
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7721
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.