[Pljava-dev] Savepoints and PL/Java

From: thomas at tada(dot)se (Thomas Hallgren)
To:
Subject: [Pljava-dev] Savepoints and PL/Java
Date: 2006-10-04 05:17:44
Message-ID: 452343F8.60408@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

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
>

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Markus Schaber 2006-10-04 08:48:53 [Pljava-dev] Savepoints and PL/Java
Previous Message Jeffrey Lyon 2006-10-04 00:13:00 [Pljava-dev] Savepoints and PL/Java