Access to Underlying Connection in LRC Mode

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Access to Underlying Connection in LRC Mode

Amin Abbaspour
Hi All,

Why 'getConnection()' in 'LrcConnectionHandle' class has 'private' access? How can I get underlying connection when using LRC?

Regards,
Amin
Reply | Threaded
Open this post in threaded view
|

Re: Access to Underlying Connection in LRC Mode

Ludovic Orban
Administrator
Hi Amin,

This is somewhat the same problem as here: http://www.nabble.com/oracle--OracleConnection-interface-to12406068.html

I did not see any use for this so I did not allow unwrapping connections. I will change this in version 1.2 but in the meantime you can workaround the problem by using reflection.

Please note that LrcConnectionHandle.getConnection() will throw an SQLException when the connection has been closed. I will change this behavior for version 1.2 so that it will return a null connection instead. This is the change that is the least intrusive in the codebase.

Do you think that would be okay ?

Ludovic
Reply | Threaded
Open this post in threaded view
|

Re: Access to Underlying Connection in LRC Mode

Amin Abbaspour
Hi Ludovic,

Access to unwrapped connection is inevitable in some vendor specific implementations. I already used a code like the one you mentioned in the other post. Thanks for it.

Then another question comes to mind. Unless I close the underlying connection manually, why would I end up with a LrcConnectionHandle with a closed connection? Why should this happen? If this is inevitable, what can the developer do in such a case?

Regards,
Amin


Ludovic Orban wrote
Hi Amin,

This is somewhat the same problem as here: http://www.nabble.com/oracle--OracleConnection-interface-to12406068.html

I did not see any use for this so I did not allow unwrapping connections. I will change this in version 1.2 but in the meantime you can workaround the problem by using reflection.

Please note that LrcConnectionHandle.getConnection() will throw an SQLException when the connection has been closed. I will change this behavior for version 1.2 so that it will return a null connection instead. This is the change that is the least intrusive in the codebase.

Do you think that would be okay ?

Ludovic
Reply | Threaded
Open this post in threaded view
|

Re: Access to Underlying Connection in LRC Mode

Ludovic Orban
Administrator
Hi Amin,

The LrcConnectionHandle sets its internal reference to the underlying connection to null when you (or the TM) call close() on it.

In short: after you close the connection you got from the PoolingDataSource. This most probably won't be a problem but I prefer to ask.

Ludovic