Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wdi51-0002HW-Qe for pgsql-interfaces@arkaria.postgresql.org; Fri, 25 Apr 2014 15:30:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wdi51-0001oz-Aq for pgsql-interfaces@arkaria.postgresql.org; Fri, 25 Apr 2014 15:30:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wdi50-0001oc-DE for pgsql-interfaces@postgresql.org; Fri, 25 Apr 2014 15:30:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wdi4x-0004sU-RE for pgsql-interfaces@postgresql.org; Fri, 25 Apr 2014 15:30:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s3PFUIvL007738; Fri, 25 Apr 2014 11:30:18 -0400 From: Tom Lane To: Karthik Segpi cc: pgsql-interfaces@postgresql.org Subject: Re: JDBC API to send SimpleQuery ('Q')? In-reply-to: References: Comments: In-reply-to Karthik Segpi message dated "Fri, 25 Apr 2014 11:10:43 -0400" Date: Fri, 25 Apr 2014 11:30:18 -0400 Message-ID: <7737.1398439818@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-interfaces Precedence: bulk Sender: pgsql-interfaces-owner@postgresql.org Karthik Segpi 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