X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 064849FB259 for ; Fri, 11 Aug 2006 12:19:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 08486-10 for ; Fri, 11 Aug 2006 15:19:48 +0000 (UTC) X-Greylist: delayed 00:24:54.850128 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 8ED5D9FB26A for ; Fri, 11 Aug 2006 12:19:48 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mail.liquidcore.com (mail.liquidcore.com [70.151.60.104]) by svr4.postgresql.org (Postfix) with ESMTP id 6A5C05AF031 for ; Fri, 11 Aug 2006 14:55:10 +0000 (GMT) Received: (from root@localhost) by mail.liquidcore.com (8.13.1/8.13.1) id k7BEtJ0i017946 for pgsql-jdbc@postgresql.org; Fri, 11 Aug 2006 09:55:19 -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 k7BEtJ5q017864 for ; Fri, 11 Aug 2006 09:55:19 -0500 Message-ID: <44DC999E.8040409@nqadmin.com> Date: Fri, 11 Aug 2006 09:52:14 -0500 From: Prasanth Reply-To: dbadmin@nqadmin.com User-Agent: Thunderbird 1.5 (X11/20060313) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: ClassCastException org.postgresql.jdbc3.Jdbc3Connection 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=1.384 tagged_above=0 required=5 tests=SPF_SOFTFAIL X-Spam-Level: * X-Archive-Number: 200608/66 X-Sequence-Number: 15593 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.