agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] Savepoints and PL/Java
Date: Wed, 04 Oct 2006 07:17:44 +0200
Message-ID: <452343F8.60408@tada.se> (raw)
In-Reply-To: <54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com>
References: <54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com>
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
>
view thread (5+ messages) latest in thread
Message-ID: <452343F8.60408@tada.se>
Permalink: ../452343F8.60408@tada.se/
Also on: postgresql.org/message-id/452343F8.60408@tada.se
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] Savepoints and PL/Java
In-Reply-To: <452343F8.60408@tada.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox