agora inbox for pgsql-interfaces@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Karthik Segpi <karthik.segpi@gmail.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: JDBC API to send SimpleQuery ('Q')?
Date: Fri, 25 Apr 2014 11:30:18 -0400
Message-ID: <7737.1398439818@sss.pgh.pa.us> (raw)
In-Reply-To: <CACD7L9FeKERVub6kDqKTn7C1aYFPSM=nPJycnf+QpwKUGwq4VQ@mail.gmail.com>
References: <CACD7L9FeKERVub6kDqKTn7C1aYFPSM=nPJycnf+QpwKUGwq4VQ@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-interfaces>

Karthik Segpi <karthik.segpi@gmail.com> writes:
> I have the following Java code running in tomcat 7 using
> 'postgresql-9.3-1101-jdbc41.jar' driver.

> String str = "insert into tab1(a,b) values ('name', 'address');"
> Statement stmt = conn.createStatement();
> stmt.execute(str);

> Considering that this is *not* a PreparedStatement, I would have expected
> the driver to issue a Simple Query ('Q') instead of an ExtendedQuery ('P').
> However, when I print the incoming connection at my middleware (pgpool), I
> see the query being received is an ExtendedQuery ('P'). When I execute the
> same query in psql, it triggers a Simple Query ('Q') as expected.

You'd be better off asking about the behavior of the JDBC driver on
pgsql-jdbc, but offhand I see nothing unreasonable about it if they
choose to use extended query protocol exclusively.  Less code for
them to maintain, and it's not really less efficient as long as they
ensure messages get grouped into network packets appropriately.

(psql goes the other direction, and doesn't use extended protocol
at all, AFAIR.)

> What am I missing here? Are there any other settings that I need to tweak?

I think you could still force use of simple query mode by telling the
driver to use protocol version 2, but that has lots of downsides.

			regards, tom lane


-- 
Sent via pgsql-interfaces mailing list (pgsql-interfaces@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-interfaces



view thread (4+ messages)  latest in thread

Message-ID: <7737.1398439818@sss.pgh.pa.us>
Permalink:  ../7737.1398439818@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7737.1398439818@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, karthik.segpi@gmail.com
  Subject: Re: JDBC API to send SimpleQuery ('Q')?
  In-Reply-To: <7737.1398439818@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox