Re: Storing Large Objects: ClassCastException - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Storing Large Objects: ClassCastException
Date
Msg-id 406F4E25.7090005@opencloud.com
Whole thread Raw
In response to Storing Large Objects: ClassCastException  (Carter Harrison <gtg459b@mail.gatech.edu>)
List pgsql-jdbc
Carter Harrison wrote:
> I'm using Java to write an application that needs the ability to store
> and retrieve pdf files from a postgresql database. I'm using the code
> from the postgresql docs to store a pdf. At the bottom of this message
> is the code I'm using but right here is the line that is producing a
> ClassCastException:
>
> LargeObjectManager lobj =
> ((org.postgresql.PGConnection)conn).getLargeObjectAPI();

Are you using a connection pooling implementation?

If so, are you using a recent (CVS is probably safest) driver? In older
drivers the proxy connection objects produced by the driver (and
commonly used by connection pools) failed to implement PGConnection.

Failing that, is it possible that your client code is loading the
postgresql classes (org.postgresql.PGConnection in this case) via a
different classloader to the classloader that loaded the JDBC driver itself?

-O

pgsql-jdbc by date:

Previous
From: Carter Harrison
Date:
Subject: Storing Large Objects: ClassCastException
Next
From: Oliver Jowett
Date:
Subject: Re: AJ1Stmt.setObject()