From: | thomas at tada(dot)se (Thomas Hallgren) |
---|---|
To: | |
Subject: | [Pljava-dev] retaining prepared statements across stored procedure calls |
Date: | 2011-04-16 05:27:27 |
Message-ID: | 4DA928BF.7080100@tada.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
Yes, there are reasons. One reason is that calls can come from functions with different SecurityManagers. Keeping a
state between those calls could introduce security leaks and IIRC, the statement is attached to an SPI context. Another
reason is memory preservation. There is no natural way of doing a proper clean up unless you do it when the call ends.
There might be other reasons as well. It's been a while since I looked at the actual code.
- thomas
On 2011-04-16 01:25, Johann 'Myrkraverk' Oskarsson wrote:
>
>>> When
>>> I call callProc in psql, I get a warning about closing 1
>>> forgotten statement. Does that mean I cannot have prepared
>>> statements lingering around after each store procedure
>>> invocation?
>>>
>> Yes it does.
>> - thomas
>
> Is there a good reason for this?
>
> Is there something wrong with initializing prepared statements within a static initializer?
>
> PreparedStatment prep;
>
> static {
> //...
> prep = connection.prepareStatement( "select 1;" );
> //...
> }
>
> public static useStatement() {
> //...
> prep.executeQuery();
> //...
> }
>
From | Date | Subject | |
---|---|---|---|
Next Message | David Gradwell | 2011-04-16 09:29:44 | [Pljava-dev] 64 bit pljava |
Previous Message | Eric Kolotyluk | 2011-04-16 00:18:18 | [Pljava-dev] Windows Binaries |