Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vR9Wd-007tH7-0x for pgsql-jdbc@arkaria.postgresql.org; Thu, 04 Dec 2025 13:37:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vR9Wc-002n85-0M for pgsql-jdbc@arkaria.postgresql.org; Thu, 04 Dec 2025 13:37:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vR9Wb-002n7w-2Z for pgsql-jdbc@lists.postgresql.org; Thu, 04 Dec 2025 13:37:38 +0000 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vR9WZ-0036nz-2j for pgsql-jdbc@lists.postgresql.org; Thu, 04 Dec 2025 13:37:37 +0000 Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-88678d7ed65so8880596d6.1 for ; Thu, 04 Dec 2025 05:37:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yugabyte.com; s=google; t=1764855454; x=1765460254; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=z8WFKBncBBNLFPXm0trsKKcHdSu47+vXUL0K2iC1G2c=; b=dFRdh6WYkyW5eXYyw83OwuZwd5YXgSnMwAKuIZBkZC59f7TPyvp5HQ4+f6ab9SnkQr bCjTG6y5SDfKdDnja7DRRILZJTHAiyOWkZscX/K/Sd3cLi2hEEtIUb1tgCGH2sVGQXtr o/KMKvk638B2hddiSDq9yo6l9CIywGJKRzEU4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764855454; x=1765460254; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=z8WFKBncBBNLFPXm0trsKKcHdSu47+vXUL0K2iC1G2c=; b=BWJ3XJs4W6XGcZQeo11LfqWvaJDZq9uJgCp4H0a+wVB8QBhRylmrmJdlNfbQSQiylB VFzdbp38fH7X6BNiHEAKDcp3xWVEzZbGALwAtJXXfqAbDD7RpBaAU3UkfNoJn3enYtYb W5CKZRklU5V6/RCUI4Pa6s2Y6dImZ9Q4IWa0/p2ZsylG83gkxm1I4c0fcQZjZ5rMrBPH yeWCSrL1tI9wmaKEJ/shV1Pv21Mo9Ic4KIOk4n7G3oy/nWVprgS4n8C8TgO9+/cDhH9z Uu6ZRdaltJWCa5dSFDM6v6xY1A1eYMxzhrUKr74I2CBf+NW74aHlny9X2ntjUC8NaQc1 iV2Q== X-Gm-Message-State: AOJu0Yxj6ssZYIU0RfsKqJjHtNgF6LiCyumAfAGK3uTNeP4kIXYarxgu Q2Z2/96pu7DgnKcr7BYdbLZcbxmP7AX9ZDLNV9gEQaqOZWlZrB+iJGXQ7cPc4bb9rwLYmiP7QIe 2Yqv9D5hkALJw1MAEOpk+/3QWtsAcnjOoYMJ13oDjURD52wWzaZbomNk= X-Gm-Gg: ASbGncsOPJ3el/VeXOlHyQWGZVwUQaS8b0CE9RuPnYWcNkHzSiZY2xvehNAFUCjBFiI J6luzqeknpFaUwhPPIQkhBIBB3fBmZEx8VPLa0MVilzimhXn0dUTMGxKVOoezruKr2UXL+7bEaR 0db/zwmEBDcc4nwRCzYtMreOVWsWeHlrCyCfZxVRLBW7VvDCOBSgcLTNDIcji4lU03aIDjPYdgy bqhmuGCxFYehhuR8o7yflJ+8pkAP/0cWYrGBCn5lCyv4sCuN7bVezQZdeDkqHYS411VoYD3 X-Google-Smtp-Source: AGHT+IE5TMe7tB6P7bhqksQART1F4BOYMuO+4h5VqV62eCnpYuxdBogXU2OYU9Y9sqZGtritp3Txc+bXh4FxDENNma0= X-Received: by 2002:a05:6214:2b93:b0:882:3bc7:1909 with SMTP id 6a1803df08f44-8882489d384mr46267656d6.37.1764855453721; Thu, 04 Dec 2025 05:37:33 -0800 (PST) MIME-Version: 1.0 From: Manav Kumar Date: Thu, 4 Dec 2025 19:07:21 +0530 X-Gm-Features: AWmQ_bk4RGhPG-2YwqT-_wyEqjLdnDA_CLfO40UPpStJFNBexXCk9VcssDs31Q8 Message-ID: Subject: Don't see CLOSE packet been sent To: pgsql-jdbc@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000006633f10645206e5d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000006633f10645206e5d Content-Type: text/plain; charset="UTF-8" Hi Team, Wrote a simple below application to understand nature of CLOSE packet. But i don't see the JDBC sending CLOSE packet. Any ideas what i can do see CLOSE packet. I'm compiling with: javac -classpath /home/manavkumar/postgresql-42.7.1.jar sendClose.java && \ java -cp .:/home/manavkumar/postgresql-42.7.1.jar sendClose ```import java.sql.*; public class sendClose { public static void main(String[] args) { Connection connection = null; PreparedStatement pstmt1 = null, pstmt2 = null; try { // prepareThreshold=1 is crucial here connection = DriverManager.getConnection("jdbc:postgresql:// 10.150.3.175:5433/yugabyte?prepareThreshold=1", "yugabyte","yugabyte"); // --------------------------------------------------------- // CHANGE 1: Use placeholders (?) // This forces the driver to use Extended Query Protocol (Parse/Bind) // and create a named statement (e.g., "S_1") on the server. // --------------------------------------------------------- pstmt1 = connection.prepareStatement("insert into t_ values (?, ?)"); pstmt1.setInt(1, 1); pstmt1.setInt(2, 2); // Execute twice to ensure the driver switches to server-prepare mode pstmt1.execute(); pstmt1.execute(); pstmt1.execute(); pstmt1.execute(); pstmt1.execute(); pstmt1.execute(); pstmt1.execute(); pstmt1.execute(); pstmt1.execute(); pstmt1.execute(); // --------------------------------------------------------- // CHANGE 2: Close the statement // The driver now marks "S_1" as closed internally and queues the packet. // --------------------------------------------------------- pstmt1.close(); System.out.println("Statement 1 closed. Sending Statement 2 to flush the buffer..."); // --------------------------------------------------------- // CHANGE 3: Send ANY other traffic // The driver will attach the buffered "CLOSE S_1" packet // to the front of this new request. // --------------------------------------------------------- pstmt2 = connection.prepareStatement("SELECT 1"); pstmt2.execute(); pstmt2.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } ``` --0000000000006633f10645206e5d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Team,
Wrote a simple below application to understan= d nature of CLOSE packet.
But i don't see the JDBC sending CL= OSE packet. Any ideas what i can do see CLOSE packet.
I'm com= piling with:=C2=A0
javac -classpath /home/manavkumar/postgresql-4= 2.7.1.jar sendClose.java && \
java -cp .:/home/manavkumar/postgr= esql-42.7.1.jar sendClose

```import= java.sql*;

public class sendClose {
public static void main(String[] args) {
= Connection connection =3D null;
PreparedStatement pstmt1 =3D null, pstmt2 =3D= null;

try {
// prepareThreshold=3D1 is crucial here
=
connection =3D DriverManager.= getConnection("jdbc:postgresql://10.150.3.175:5433/yugabyte?prepareThreshold=3D1", "yugabyte",<= /span>"yugabyte");

// --------------------------------------------------= -------
= // CHANGE 1: Use placeholders = (?)
// This forces the driver to use E= xtended Query Protocol (Parse/Bind)
//= and create a named statement (e.g., "S_1") on the server.=
// -----------------------------------------= ----------------
pstmt1 =3D connecti= on.prepareStatement("insert into t_ values (?, ?)");
pstmt1.setInt(1, 1);
= pstmt1.setInt(2, 2);
// Exec= ute twice to ensure the driver switches to server-prepare mode
=
pstmt1.execute();
=
pstmt1.execute();
<= div> pstmt1.execute(); pstmt1.execute(); pstmt1.execute(); pstmt1.execute();
= pstmt1.= execute();
= pstmt1.= execute();
= pstmt1.= execute();
= pstmt1.= execute();
=
// ------------------------------= ---------------------------
// CHANGE = 2: Close the statement
// The driver n= ow marks "S_1" as closed internally and queues the packet.=
// -----------------------------------------= ----------------
pstmt1.close();

System.out.println("Statement 1 clos= ed. Sending Statement 2 to flush the buffer...");

// ----------------------------------= -----------------------
// CHANGE 3: S= end ANY other traffic
// The driver wi= ll attach the buffered "CLOSE S_1" packet
// to the front of this new request.
// ---------------------------------------------------------<= /span>
pstmt2 = =3D connection.prepareStatement("SELECT 1"<= /span>);
= pstmt2.execute();
= pstmt2.close();

= connection.close<= /span>();
<= span style=3D"color:rgb(180,180,180)">}
catch (Exception e) {
= e.printSta= ckTrace();
= }
}
}

``` --0000000000006633f10645206e5d--