oracle -OracleConnection interface

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

oracle -OracleConnection interface

Zdeněk Vráblík-3
Hi all,

I am using Tomcat 5.5.23.

I have installed Bitronix. It works fine, I am able to use without error.

But I have one request.
I need connection that implements interface OracleConnection.

Is there any way how to get it?
I have used simpleJTA1.07 (with small change in datasource factory),
but it is unstable.

Is it possible to configure bitronix to get conection that implements
interface OracleConneciton?

Thanks.
Regards,
Zdenek Vrablik

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: oracle -OracleConnection interface

Ludovic Orban
Administrator
Hi,

Unfortunately there is no easy way to get the vendor's connection behind the BTM connection wrapper. Why would you need it ?

In practice, the Connection object you're getting from a PoolingDataSource.getConnection() call is an instance of bitronix.tm.resource.jdbc.JdbcConnectionHandle class.

The JdbcConnectionHandle class has a private method called getConnection() that returns the driver's connection implementation. I guess in the Oracle case it would return an OracleConnection.

The best you can do without BTM code modifications is to call that method via reflection with something like this:

Connection c = ds.getConnection()
JdbcConnectionHandle ch = (JdbcConnectionHandle) c;
Method getConnectionMethod = c.getClass().getDeclaredMethod("getConnection", null);
getConnectionMethod.setAccessible(true);
OracleConnection oc = (OracleConnection) getConnectionMethod.invoke(ch, null);

I hope this helps.
Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: oracle -OracleConnection interface

Zdeněk Vráblík-3
Hi,
thanks.
I will look at it.

The reason is in other libraries.
I need OracleConnection, because this libraries work only with this interface.
It causes exceptions with Connection interface. I am not able to
change this libs ...

Regards,
Zdenek

On 8/30/07, Ludovic Orban <[hidden email]> wrote:

>
> Hi,
>
> Unfortunately there is no easy way to get the vendor's connection behind the
> BTM connection wrapper. Why would you need it ?
>
> In practice, the Connection object you're getting from a
> PoolingDataSource.getConnection() call is an instance of
> bitronix.tm.resource.jdbc.JdbcConnectionHandle class.
>
> The JdbcConnectionHandle class has a private method called getConnection()
> that returns the driver's connection implementation. I guess in the Oracle
> case it would return an OracleConnection.
>
> The best you can do without BTM code modifications is to call that method
> via reflection with something like this:
>
> Connection c = ds.getConnection()
> JdbcConnectionHandle ch = (JdbcConnectionHandle) c;
> Method getConnectionMethod = c.getClass().getDeclaredMethod("getConnection",
> null);
> getConnectionMethod.setAccessible(true);
> OracleConnection oc = (OracleConnection) getConnectionMethod.invoke(ch,
> null);
>
> I hope this helps.
> Ludovic
> --
> View this message in context: http://www.nabble.com/oracle--OracleConnection-interface-tf4353918.html#a12406754
> Sent from the BTM Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Loading...