Re: PROBLEMS WITH TRANSACTIONS IN JDBC
Posted in 1999
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: > con.setAutoCommit(false); > > call ... > call... > call... > > con.commit(); > > but I receive a "Not in a transaction" exception while committing. > Any idea would be appreciated. Please, some pseudocode. Don't know the ODBC function but you forgot to begin the transaction with a BEGIN WORK statement equivalent (perhaps con.begin()?), unless the database is in ANSI logging mode you need to do this before the first SP call and if all is well call con.commit() else call con.rollback(). Art S. Kagel