pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedClassCastException DelegatingPreparedStatement
2+ messages / 2 participants
[nested] [flat]
* ClassCastException DelegatingPreparedStatement
@ 2007-01-02 18:49 Kevin Murphy <murphy@genome.chop.edu>
2007-01-04 17:34 ` Re: ClassCastException DelegatingPreparedStatement Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Murphy @ 2007-01-02 18:49 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: ClassCastException DelegatingPreparedStatement
2007-01-02 18:49 ClassCastException DelegatingPreparedStatement Kevin Murphy <murphy@genome.chop.edu>
@ 2007-01-04 17:34 ` Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 2+ messages in thread
From: Kris Jurka @ 2007-01-04 17:34 UTC (permalink / raw)
To: Kevin Murphy <murphy@genome.chop.edu>; +Cc: pgsql-jdbc
On Tue, 2 Jan 2007, Kevin Murphy wrote:
> 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
>
DBCP is wrapping the postgresql statement so you need to unwrap it using
something like:
Statement unwrapped =
((DelegatingPreparedStatement)prestmt).getInnermostDelegate();
org.postgresql.PGStatement pgstmt = (org.postgresql.PGStatement)unwrapped;
Kris Jurka
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-01-04 17:34 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-01-02 18:49 ClassCastException DelegatingPreparedStatement Kevin Murphy <murphy@genome.chop.edu>
2007-01-04 17:34 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox