X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 70D8A9FB1FC for ; Fri, 11 Aug 2006 13:31:39 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 91306-08 for ; Fri, 11 Aug 2006 13:31:24 -0300 (ADT) X-Greylist: delayed 01:36:29.939939 by SQLgrey- Received: from mail.liquidcore.com (mail.liquidcore.com [70.151.60.104]) by postgresql.org (Postfix) with ESMTP id 938459FA463 for ; Fri, 11 Aug 2006 13:31:23 -0300 (ADT) Received: (from root@localhost) by mail.liquidcore.com (8.13.1/8.13.1) id k7BGVYHl029137 for pgsql-jdbc@postgresql.org; Fri, 11 Aug 2006 11:31:34 -0500 Received: from [192.168.0.81] (ppasalalinux.nqadmin.com [192.168.0.81]) by mail.liquidcore.com (8.13.1/8.13.1) with ESMTP id k7BGVXlq029051 for ; Fri, 11 Aug 2006 11:31:33 -0500 Message-ID: <44DCB02B.7080401@nqadmin.com> Date: Fri, 11 Aug 2006 11:28:27 -0500 From: Prasanth Reply-To: dbadmin@nqadmin.com User-Agent: Thunderbird 1.5 (X11/20060313) MIME-Version: 1.0 CC: pgsql-jdbc@postgresql.org Subject: Re: ClassCastException org.postgresql.jdbc3.Jdbc3Connection References: <44DC999E.8040409@nqadmin.com> In-Reply-To: <44DC999E.8040409@nqadmin.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-scanner: Scanned for malicious content X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.1 tagged_above=0 required=5 tests=AWL, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/67 X-Sequence-Number: 15594 I think I got it. The server had a jar & my WAR has the same jar. Probably the JNDI used the jar in the server while my application used the class from the jar in the WAR. As these are two different class files I was getting the class cast exception. -Prasanth. Prasanth wrote: > I am trying to get the PGConnection/Jdbc3Connection object from > Connection class. > The connection class returned is > org.jboss.resource.adapter.jdbc.WrappedConnection (as I am using JNDI in > JBoss). > > When I try to get the underlying connection and cast it to > Jdbc3Connection I am getting a class cast exception. > > Below is the code. > Connection conn = > ((WrappedConnection)DBConnection.getConnection()).getUnderlyingConnection(); > LargeObjectManager lobj = > ((org.postgresql.jdbc3.Jdbc3Connection)conn).getLargeObjectAPI(); > > In the above code DBConnection class provides a method to get the > connection object from the pool. > > Exception: > 09:42:33,016 WARN [RequestProcessor] Unhandled Exception thrown: class > java.lang.ClassCastException > 09:42:33,017 ERROR [[action]] Servlet.service() for servlet action threw > exception > java.lang.ClassCastException: org.postgresql.jdbc3.Jdbc3Connection > > > As you can see it says that the object is of type Jdbc3Connection so why > does it give a class cast exception then? > > I am using postgresql-8.1-404.jdbc3.jar driver & the database is 8.1.3. > > Thanks, > -Prasanth. > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >