Re: Back to performance issues for a moment... (RE: Prepared

From: Barry Lind <blind(at)xythos(dot)com>
To: nickf(at)ontko(dot)com
Cc: pgsql-jdbc(at)postgresql(dot)org, Fernando Nasser <fnasser(at)redhat(dot)com>
Subject: Re: Back to performance issues for a moment... (RE: Prepared
Date: 2003-07-18 16:16:23
Message-ID: 3F181D57.8040203@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Nick,

Nick Fankhauser wrote:
>>In any case, try using server prepared statements by setting your
>
> statement to
>
>>use that option (you must be using a backend at least of version 7.3):
>>
>>setUseServerPrepare(true);
>
>
> Hi folks-
>
> Sorry to pull things backward here, but having set my web user up with sane
> grants, I'm a bit more concerned about the performance issues- I can't find
> this method in the Sun JDBC spec, so I'm assuming it is PostgreSQL-specific?
>
> Is this the correct way to use it:
>
> PreparedStatement ps = db.prepareStatement("select foo from bar where foo
> like ?");
> ps.setUseServerPrepare(true);
> .

Close, but you need to cast your PreparedStatement to
org.postgresql.PGStatement to get access to this method.

> .
> .
> ps.setString(1, "fubar");
> ResultSet rs = ps.executeQuery();
>
> (Where the first two lines get executed once when I init my app, but the
> last two lines may get executed any number of times.)
>
> Also- is the javadoc for postgresql JDBC online anywhere for folks like
> myself who just download the current stable jarfile?
>

This should be documented in the JDBC chapter of the Postgresql
Programers Guide in the section titled Postgresql Extensions to the JDBC
API. But this section of the doc is out of date and therefore you
wouldn't find this information there.

thanks,
--Barry

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Fernando Nasser 2003-07-18 16:51:40 Re: Prepared Statements
Previous Message Felipe Schnack 2003-07-18 16:14:11 Re: Prepared Statements