Re: Connection.setBytes()

From: Joachim Achtzehnter <joachim(at)kraut(dot)bc(dot)ca>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Connection.setBytes()
Date: 2000-07-18 19:57:16
Message-ID: Pine.WNT.4.21.0007181248340.131-100000@van4
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-novice

On Tue, 18 Jul 2000, Christoph Schmidt wrote:
>
> where is the point to turn autocommit off ?

You turn it off by calling a method on Connection.

> I am new to PREPARED STATEMENT...
> Where can i find the documentation ?

See the JDBC documentation on Sun's Web site, or any recent Java book.

> How much more efficient is it ?

Unfortunately, with Postgresql PreparedStatement is not more efficient
because Postgresql does not cache queries on the server. The Postgresql
JDBC driver must expand the '?' placeholders on the client-side and send
the complete query to the backend.

Even without the performance advantage, PreparedStatement can be more
convenient because it adds some value. For example, when a '?' is replaced
by a string using setString() the driver will escape any single quotes
that may be contained in the string. If you construct the query yourself
it is your responsibility to get this right.

Joachim

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Matt Fair 2000-07-18 20:00:43 Re: Connection.setBytes()
Previous Message Joachim Achtzehnter 2000-07-18 19:48:15 Re: Connection.setBytes()

Browse pgsql-novice by date

  From Date Subject
Next Message Matt Fair 2000-07-18 20:00:43 Re: Connection.setBytes()
Previous Message Joachim Achtzehnter 2000-07-18 19:48:15 Re: Connection.setBytes()