Re: Storing Large Objects: ClassCastException

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Carter Harrison <gtg459b(at)mail(dot)gatech(dot)edu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Storing Large Objects: ClassCastException
Date: 2004-04-03 23:52:05
Message-ID: 406F4E25.7090005@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-04-04 00:03:53 Re: AJ1Stmt.setObject()
Previous Message Carter Harrison 2004-04-03 20:38:14 Storing Large Objects: ClassCastException