commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wiedmann <jochen.wiedm...@gmail.com>
Subject Re: [DBCP] Possible strategy for multiple JDBC version support
Date Wed, 05 Jun 2013 11:37:05 GMT
On Tue, Jun 4, 2013 at 11:29 AM, sebb <sebbaz@gmail.com> wrote:

> DBCP is complicated to release, because the source has to be
> pre-processed in order to build additional versions of the code.
> (unlike the rest of Java, JDBC is not generally upwards compatible).
>

Alternative proposal (worked for me in the past in similar situations):

Create the instances of Connection, Statement, etc. using
java.lang.reflect.Proxy, with a suitable InvocationHandler. The instances
generated by Proxy are implementing the runtime version of the respective
interface, hence no compatibility problems. The InvocationHandler doesn't
implement anything, hence can adjust its behaviour at runtime to the proper
JDBC version.

Jochen

-- 
"That's what prayers are ... it's frightened people trying to make friends
with the bully!"

Terry Pratchett. The Last Hero

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message