| From: | Dave Cramer <pg(at)fastcrypt(dot)com> | 
|---|---|
| To: | John Lister <john(dot)lister(at)kickstone(dot)com> | 
| Cc: | Thomas Finneid <tfinneid(at)fcon(dot)no>, pgsql-jdbc(at)postgresql(dot)org | 
| Subject: | Re: pooled prepared statements | 
| Date: | 2009-05-12 17:16:44 | 
| Message-ID: | 491f66a50905121016r39d78f29k145e2cc53c498586@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-jdbc | 
On Tue, May 12, 2009 at 11:58 AM, John Lister <john(dot)lister(at)kickstone(dot)com>wrote:
> Thomas Finneid wrote:
>
>> When a PreparedStatment is created by a pooled connection, as far as I
>> understand if, that creation happens on the server side, and a reference, of
>> sorts, is returned to the client jdbc.
>>
>> Is that prepared statement shared among the connections or is it only
>> available to that single connection? and more importantly, can many
>> connections use that prepared statement concurrently?
>>
>> If it is shared, then it must be usable by concurrent connections,
>> otherwise it will be difficult for the client to know if the statement is
>> occupied or not. So I just want to confirm that I understand how the JDBC
>> driver works.
>>
> Once the query usage count exceeds the prepareThreshold parameter, then the
> driver does create a "prepare statement object" on the server. This is only
> valid for the time the PreparedStatement is open and only on that
> connection. So to answer your question, they cannot be shared by multiple
> connections.
>
> You can create your own using the PREPARE and EXECUTE sql commands so long
> as you track them across different connections...
AFAIK, you can't do that either assuming you mean prepare on one connection
and execute on another ?
Dave
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | John Lister | 2009-05-12 17:48:01 | Re: pooled prepared statements | 
| Previous Message | John Lister | 2009-05-12 15:58:07 | Re: pooled prepared statements |