diff --git a/java/server/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcBackedSessionMap.java b/java/server/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcBackedSessionMap.java index 6ad859f077573..7e1aa50001ff2 100644 --- a/java/server/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcBackedSessionMap.java +++ b/java/server/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcBackedSessionMap.java @@ -131,8 +131,8 @@ public Session get(SessionId id) throws NoSuchSessionException { public void remove(SessionId id) { Require.nonNull("Session ID", id); - try { - getDeleteSqlForSession(id).executeUpdate(); + try (PreparedStatement statement = getDeleteSqlForSession(id)) { + statement.executeUpdate(); } catch (SQLException e) { throw new JdbcException(e.getMessage()); }