Re: Using CopyManager with pooled JCA connection

From: Jim Garrison <jim(dot)garrison(at)nwea(dot)org>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Using CopyManager with pooled JCA connection
Date: 2013-09-12 20:25:16
Message-ID: 0C723FEB5B4E5642B25B451BA57E27303EE03350@S1P5DAG3C.EXCHPROD.USA.NET
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> Try getPhysicalConnection()[1]. It's defined as returning an Object but internally it looks like it has the actual connection (in this case a java.sql.Connection). You'll probably just have to cast it to a java.sql.Connection.
>
> [1]: http://grepcode.com/file/repo1.maven.org/maven2/org.tranql/tranql-connector/1.6/org/tranql/connector/ManagedConnectionHandle.java/#32

Thanks for the link. I tried this but unfortunately it returns a proxy object:

import org.tranql.connector.jdbc.ConnectionHandle;
...
private BaseConnection getBaseConnection(Connection con)
{
BaseConnection temp = null;
if (con instanceof ConnectionHandle)
temp = (BaseConnection) ((ConnectionHandle) con).getAssociation().getPhysicalConnection(); // << exception here
else
temp = (BaseConnection) con;
return temp;
}

java.lang.ClassCastException: $Proxy46 cannot be cast to org.postgresql.core.BaseConnection

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jim Garrison 2013-09-12 21:11:08 Re: Using CopyManager with pooled JCA connection
Previous Message Jim Garrison 2013-09-12 19:07:35 Using CopyManager with pooled JCA connection