agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] Savepoints and PL/Java
Date: Fri, 06 Oct 2006 07:11:57 +0200
Message-ID: <4525E59D.6020503@tada.se> (raw)
In-Reply-To: <AA5FDE6A-2C97-4B08-B504-B4814757A43B@mac.com>
References: <54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com>
	<452343F8.60408@tada.se>
	<890B225A-384F-4D93-A5FE-55E47832FD81@mac.com>
	<4523D367.90404@tada.se>
	<AA5FDE6A-2C97-4B08-B504-B4814757A43B@mac.com>

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
>>>>>
>>>>
>>>
>>
>





view thread (5+ messages)  latest in thread

Message-ID: <4525E59D.6020503@tada.se>
Permalink:  ../4525E59D.6020503@tada.se/
Also on:    postgresql.org/message-id/4525E59D.6020503@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: <4525E59D.6020503@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