[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-06 05:11:57
Message-ID: 4525E59D.6020503@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Hi Jeffrey,
Haven't seen that one before. Can you tell me what configuration you're
on?, I.e. OS, JVM, PostgreSQL and PL/Java versions. I would also like to
see the backend log at the time of the error. What kind of SQL statement
is it that calls this function?

Regards,
Thomas Hallgren

Jeffrey Lyon wrote:
> Thomas,
>
> I get the error when I set the Savepoint.
>
> Thanks,
>
> Jeff
>
> On Oct 4, 2006, at 11:29 AM, Thomas Hallgren wrote:
>
>> Hi Jeffrey,
>> Do you get this when you release the savepoint or when you roll back.
>> If it's the latter, then I'm curious to what kind of exception you
>> get. Some exceptions (syntax errors for instance) are considered
>> fatal by PostgreSQL and cannot be recovered.
>>
>> Regards,
>> Thomas Hallgren
>>
>> Jeffrey Lyon wrote:
>>> Thomas,
>>>
>>> K, so now I have, effectively -
>>>
>>> int something()
>>> {
>>> Database db = DriverManager.getConnection("jdbc:default:connection");
>>> Savepoint savePoint = db.setSavepoint();
>>>
>>> int result;
>>>
>>> try
>>> {
>>> result = trySomethingWithSQL(db);
>>> db.releaseSavepoint(savePoint);
>>> return result;
>>> }
>>> catch (Exception e)
>>> {
>>> db.rollback(savePoint);
>>> return -1;
>>> }
>>> };
>>>
>>> - and I'm getting a 'ERROR: buffer 125 is not owned by resource
>>> owner TopTransaction' from pgsql. Am I still missing something?
>>>
>>> Thanks for the help,
>>>
>>> Jeff
>>>
>>>
>>> On Oct 4, 2006, at 1:17 AM, Thomas Hallgren wrote:
>>>
>>>> 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 Joshua Ross 2006-10-06 19:48:04 [Pljava-dev] Deployment Descriptor Problem
Previous Message Markus Schaber 2006-10-04 08:48:53 [Pljava-dev] Savepoints and PL/Java