[Pljava-dev] retaining prepared statements across stored procedure calls

From: acheung02 at hotmail(dot)com (Alvin C)
To:
Subject: [Pljava-dev] retaining prepared statements across stored procedure calls
Date: 2011-04-11 20:01:10
Message-ID: DUB103-w4058D109F7165ACBB748BCBEA80@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev


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: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20110411/bc9548d7/attachment.html>

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Alvin C 2011-04-11 22:03:23 [Pljava-dev] retaining prepared statements across stored procedure calls
Previous Message bartdeman 2011-03-12 21:29:21 [Pljava-dev] Problem with PLJava on production machine