import java.sql.*; public class Cancel { public static void main(String args[]) throws Exception { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5851/jurka", "jurka", ""); Statement stmt = conn.createStatement(); stmt.cancel(); ResultSet rs = stmt.executeQuery("SELECT 1"); } }