Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a6FSJ-0006jN-SO for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Dec 2015 10:25:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a6FSJ-0004pu-Bu for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Dec 2015 10:25:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a5xjt-0007JL-Oi for pgsql-bugs@postgresql.org; Mon, 07 Dec 2015 15:30:09 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1a5xjn-0002vm-Vo for pgsql-bugs@postgresql.org; Mon, 07 Dec 2015 15:30:06 +0000 MIME-Version: 1.0 Subject: BUG #13803: too many clients exception To: pgsql-bugs@postgresql.org From: sebastian.sierra@netbeam.com.co Date: Mon, 07 Dec 2015 15:29:28 +0000 Message-ID: <20151207152928.2629.79886@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13803 Logged by: Sebastian Sierra Email address: sebastian.sierra@netbeam.com.co PostgreSQL version: 9.4.0 Operating system: windows Description: hello, im using postgresql as my app database, but i find out it isn't cleaning connections when i use conn.close() in java with jdbc, it clean them but not instantly after i send this command, i find out using this query select * from pg_stat_database; there you can see numbackends are not closing, they stay almost 3 seconds, some times even more can you check if it's your problem? this is the way im doing my querys List devices = new ArrayList<>(); Connection con = null; try { con = getDatasource().getConnection(); PreparedStatement ps = con.prepareStatement(getDevices); ps.setInt(1, company); System.out.println(ps.toString()); ResultSet rs = ps.executeQuery(); while (rs.next()) { DeviceDTO deviceDTO = new DeviceDTO(); Device device = new Device(rs.getString("device_serial"), rs.getInt("state"), rs.getInt("device_sleep"), rs.getString("objecttypedescription"), rs.getString("description"), new ArrayList<>(), new ArrayList<>()); /** PreparedStatement ps2 = con.prepareStatement(getMeasures); int i = 1; ps2.setString(i, device.getSerial()); i++; ps2.setInt(i, company); i++; ps2.setString(i, dateSince); i++; ps2.setString(i, dateUntil); ResultSet rs2 = ps2.executeQuery(); while (rs2.next()) { device.getMeasures() .add(new MeasureDTO(rs.getInt("measure_id"), rs.getString("measure_name") + " - " + rs.getString("measure_unit"), rs.getDouble("value"), rs.getString("date"))); } ps2.close(); rs2.close();*/ deviceDTO.copyDevicePOJOtoDeviceDTO(device); devices.add(deviceDTO); } rs.close(); ps.close(); } catch (SQLException e) { System.out.println("DeviceImpl sql exception on getCompanyDevices: " + e.getMessage()); }finally { if (null != con ) { try { con.close(); } catch (SQLException e) { System.out.println(e.getMessage()); } } } return devices; } -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs