From: acheung02 at hotmail.com (Alvin C) Date: Mon, 11 Apr 2011 20:01:10 +0000 Subject: [Pljava-dev] retaining prepared statements across stored procedure calls Message-ID: Hi, I have a stored procedure class that looks like this: class TestSP{ public static TestSP testSP = null; // singleton instance public PreparedStatement stmt; // member variable TestSP() throws SQLException { Connection conn = DriverManager.getConnection("jdbc:default:connection"); this.stmt = conn.prepareStatement("select 1"); conn.close(); } // stored procedure public static int callProc () throws SQLException { if (testSP == null) testSP = new TestSP(); ResultSet rs = testSP.testStmt.executeQuery(); rs.next(); return(rs.getInt(1)); }} When I call callProc in psql, I get a warning about closing 1 forgotten statement. Does that mean I cannot have prepared statements lingering around after each store procedure invocation? Thanks,Alvin -------------- next part -------------- An HTML attachment was scrubbed... URL: