pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Murphy <murphy@genome.chop.edu>
To: pgsql-jdbc@postgresql.org
Subject: ClassCastException DelegatingPreparedStatement
Date: Tue, 02 Jan 2007 13:49:59 -0500
Message-ID: <459AA957.9080007@genome.chop.edu> (raw)

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




view thread (2+ messages)  latest in thread

Message-ID: <459AA957.9080007@genome.chop.edu>
Permalink:  ../459AA957.9080007@genome.chop.edu/
Also on:    postgresql.org/message-id/459AA957.9080007@genome.chop.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: murphy@genome.chop.edu
  Subject: Re: ClassCastException DelegatingPreparedStatement
  In-Reply-To: <459AA957.9080007@genome.chop.edu>
  References: <459AA957.9080007@genome.chop.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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