ERROR: no value found for parameter 1 with JDBC and Explain Analyze

From: "Virag Saksena" <v_saks(at)hotmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: ERROR: no value found for parameter 1 with JDBC and Explain Analyze
Date: 2005-11-15 10:06:33
Message-ID: BAY103-F11ECB17126271926CB8DE1EC5D0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,
I am trying to use Explain Analyze to trace a slow SQL statement called from
JDBC.
The SQL statement with the parameters taked 11 seconds. When I run a explain
analyze from psql, it takes < 50 ms with a reasonable explain plan. However
when I try to run an explain analyze from JDBC with the parameters, I get
error :
ERROR: no value found for parameter 1

Here is sample code which causes this exception ...
pst=prodconn.prepareStatement("explain analyze select count(*) from
jam_heaprel r where heap_id = ? and parentaddr = ?");
pst.setInt(1,1);
pst.setInt(2,0);
rs=pst.executeQuery();

java.sql.SQLException: ERROR: no value found for parameter 1
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:240)
at jsp._testexplain_2ejsp._jspService(_testexplain_2ejsp.java:82)
at org.gjt.jsp.HttpJspPageImpl.service(HttpJspPageImpl.java:75)

Regards,

Virag

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Luke Lonergan 2005-11-15 12:09:56 Re: Hardware/OS recommendations for large databases (
Previous Message Magnus Hagander 2005-11-15 08:47:37 Re: Help speeding up delete