Re: [JDBC] Prepared statement performance...

Barry Lind <barry@xythos.com>

From: Barry Lind <barry@xythos.com>
To: Jochem van Dieten <jochemd@oli.tudelft.nl>
Cc: pgsql-general@postgresql.org, pgsql-jdbc@postgresql.org
Date: 2002-09-27T19:02:02Z
Lists: pgsql-general
Jochem,

Currently you probably can't.  But given the information I have 
mentioned in my previous mails in this thread, I am not sure that you 
would really want to unless you somehow have the ability to do it 
statement by statement since in most cases I think you don't want to use 
server side prepared statements.

If someone can think of a way through the standard jdbc api to 
enable/disable something like this at the statement level I am all ears. 
  I haven't been able to think of a mechanism other that the one that 
has been implemented.

thanks,
--Barry

Jochem van Dieten wrote:
> Barry Lind wrote:
> 
>>
>> Your first option is what has been implemented.  In 7.3 the server now
>> supports 'prepare <name> as <sql>' and 'execute <name>' (and variants
>> for passing bind variables).  The jdbc driver also now has a method on
>> org.postgresql.PGStatement.setUseServerPrepare(true) to enable the the
>> use of server side prepared statements (so you can cast your Statement
>> object to an org.postgresql.PGStatement object and enable the
>> functionality for a specific statement).
> 
> [..]
> 
>> It is for the reasons above that the developer needs to explicitly turn
>> on the use of server side prepared statements when it makes sense to 
>> do so.
> 
> 
> How would the developer do that? With the front-end I am working with 
> (ColdFusion MX) I have very little control over the actual calls to the 
> driver. I can make CF MX use createStatement() or prepareStatement() but 
> that is all the control I have. And the only way to send parameters to 
> the driver would be through a JDBC URL.
> Would that enable me to use prepared statements for real or not?
> 
> Jochem
> 
>