From: thomas at tada.se (Thomas Hallgren) Date: Wed, 04 Oct 2006 07:17:44 +0200 Subject: [Pljava-dev] Savepoints and PL/Java In-Reply-To: <54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com> References: <54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com> Message-ID: <452343F8.60408@tada.se> Hi Jeffrey, AFAIK, there's no such thing as a Connection.commit(Savepoint). You can only release or roll it back. Both the Connection.release(Savepoint) and Connection.rollback(Savepoint) methods are available in PL/Java. Kind Regards, Thomas Hallgren Jeffrey Lyon wrote: > Perhaps an easy one... > > I'd like to drop a Savepoint to be committed or rolled-back, > depending upon the results of a function call, i.e.: > > int something() > { > Database db = DriverManager.getConnection("jdbc:default:connection"); > Savepoint savePoint = db.setSavepoint(); > > int result; > > try > { > result = trySomethingWithSQL(db); > } > catch (Exception e) > { > db.rollback(savePoint); > return -1; > } > > db.commit(savePoint); > return result; > }; > > I see that, although setSavepoint and releaseSavepoint are available, > commit and rollback are not. What is the point of set/ > releaseSavepoint if I cannot commit or rollback from a Savepoint? Is > there any other way to accomplish the above? > > Thanks in advance, > > Jeff Lyon > > _______________________________________________ > Pljava-dev mailing list > Pljava-dev at gborg.postgresql.org > http://gborg.postgresql.org/mailman/listinfo/pljava-dev >