ClassCastException DelegatingPreparedStatement

From: Kevin Murphy <murphy(at)genome(dot)chop(dot)edu>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: ClassCastException DelegatingPreparedStatement
Date: 2007-01-02 18:49:59
Message-ID: 459AA957.9080007@genome.chop.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I'm just getting around to testing out the advice I got from this list a
couple weeks ago about prepare thresholds (thanks, Mark & Dave).

Using code modeled after the PG JDBC "Server Prepared Statements" code
example, I'm getting this runtime error:

java.lang.ClassCastException:
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement

on the line marked with an asterisk:

try {
Class.forName("org.postgresql.Driver");
} catch(Exception e) {
printError("org.postgresql.Driver class not found in
getMedlineListFromParsedText(): ", e.getMessage());
}
prestmt = conn.prepareStatement(query);
* org.postgresql.PGStatement pgstmt =
(org.postgresql.PGStatement)prestmt;
pgstmt.setPrepareThreshold(0);

I'm using DBCP pooled connections within tomcat. Versions: PG 8.1,
postgresql-8.1-407.jdbc3.jar, tomcat 5.5.20, Java 1.5

My Java newbie status is hobbling me. Thanks for any pointers.

Thanks,
Kevin

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2007-01-02 18:50:23 Re: Help with RULES - Please!
Previous Message Jeanna Geier 2007-01-02 18:24:38 Help with RULES - Please!