Re: TRANSACTIONS: THE RETURN
Posted in 1999
On Mon, Mar 08, 1999 at 10:10:37AM +0100, ASC wrote: > Hello, > This is my problem. I have to implement a transaction in some steps. > > I mean, the aim is to save the state of the database (Informix Online > Dynamic Server 7.2). Then call some stored procedures that doesn't > commit, and if everything was ok, commit the transaction. How can I > achieve this using JDBC? > I have tried with: > > try { > con.setAutoCommit(false); > Have you tried to run here a "BEGIN WORK" statement (I mean just prepare it and run)? As I understand it should work without this, but may be it is a bug in the JDBC driver (or I don't understand the autocommit feature). Best Regards, Octav > call ... > call... > call... > > con.commit(); > }catch(Exception e) { con.rollback(); } > > but I receive a "Not in a transaction" exception while committing. > How can I init a transaction in JDBC? > Any idea would be appreciated. Please, some pseudocode. > -- Octav Chiriac Phone: (373) 2 21 20 96 NetInfo S.R.L. Fax: (373) 2 21 36 59 Chisinau (373) 2 24 00 83 Moldova, Republic of mailto:com@netinfo-moldova.com