pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Rotteveel <mark@lawinegevaar.nl>
To: List <pgsql-jdbc@postgresql.org>
Subject: Re: Pre-processing during build
Date: Thu, 18 Jun 2015 08:37:04 +0200
Message-ID: <5c048c77d5a5e567790ab932f92fac12@imap.procolix.com> (raw)
In-Reply-To: <006601d0a940$7a418620$6ec49260$@eu>
References: <000c01d0a7b6$97571ee0$c6055ca0$@eu>
	<CADK3HHK9TUug9amtabv1a+27u_bb31FCsLBarWsPv_PD12JCcw@mail.gmail.com>
	<CAB=Je-FC6NE7z=OMpfGRyOPk--Fw6Uci9iFbu+JQ1THfeuhgHA@mail.gmail.com>
	<CADK3HHJo=bjA9z=ZBzk-vqxfu+0Eh4UmLd0WJUhngKAVYogz8w@mail.gmail.com>
	<005101d0a86a$f18ffe90$d4affbb0$@eu>
	<CAB=Je-G1+7x4LabgB6A4cF_RY0CV1RwbDryFXa0GioB_vg7o=g@mail.gmail.com>
	<60b20bb834cf54db8232239b9c27fcc2@imap.procolix.com>
	<CADK3HHLmYp34yxQzjEuGgsUW4+joghHZf+0FBr44K8i5hXA+BA@mail.gmail.com>
	<ba57c14862b915a79a69de9089df736e@imap.procolix.com>
	<CAB=Je-HbMx0+s_cuMk68P8v9EymT4UM18Y0aJKqnZCiivABfYw@mail.gmail.com>
	<2e15428aa0cf241e6cd9b951ba96140b@imap.procolix.com>
	<5d539d76f4ccb9a59abc57d5d99c4d92@imap.procolix.com>
	<006601d0a940$7a418620$6ec49260$@eu>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

On Wed, 17 Jun 2015 22:59:18 +0200, "Markus KARG" <markus@headcrashing.eu>
wrote:
>>I just realized it might actually work: some (maybe all) methods added
in
> the JDBC API for Java 8 were added as default interface methods (with an
> implementation that throws UnsupportedOperationException), so
compilation
> would succeed for org.postgresql.jdbc4.PreparedStatement without having
an
> implementation for the new methods.
> 
> Yay, seems you finally noticed we guys at the Java EE EGs are not so
dumb
> as people might think! Honestly, what do you think what we actually
> invented default methods for if not for this case...? ;-)

It still doesn't solve the problem if you actually have an implementation
of that method in your class, which was the starting point of the
discussion as I saw it.

>>You'd still need reflection or an other trick to decide based on the
Java
> version which classes (Statement, PreparedStatement, ResultSet, etc) to
> instantiate.
> 
> Only in case of one single driver name and not wanting to provide a
> property telling the JDBC version. Also not in case of separate driver
> names like "Jdbc3Driver". In fact I do not see any difference in
providing
> a list of separate downloads compared to a list of separate driver
names.

It is a problem (although solvable), because JDBC 4 driver loading
requires you to provide a META-INF/services/java.sql.Driver file that
declares the driver(s) provided by the jar. This means that the driver it
declares must be loadable in all JVMs. This means that you either need to
provide a single driver that handles the differences, or you need to have
multiple drivers and ensure that the JDBC4 driver refuses to create
connections if the JDBC 4.1 or 4.2 driver is also loaded.

It will also make things harder for tools that want to load your driver
directly (instead of going through DriverManager).

Mark




-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (92+ messages)  latest in thread

Message-ID: <5c048c77d5a5e567790ab932f92fac12@imap.procolix.com>
Permalink:  ../5c048c77d5a5e567790ab932f92fac12@imap.procolix.com/
Also on:    postgresql.org/message-id/5c048c77d5a5e567790ab932f92fac12@imap.procolix.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: mark@lawinegevaar.nl
  Subject: Re: Pre-processing during build
  In-Reply-To: <5c048c77d5a5e567790ab932f92fac12@imap.procolix.com>
  References: <000c01d0a7b6$97571ee0$c6055ca0$@eu> <CADK3HHK9TUug9amtabv1a+27u_bb31FCsLBarWsPv_PD12JCcw@mail.gmail.com> <CAB=Je-FC6NE7z=OMpfGRyOPk--Fw6Uci9iFbu+JQ1THfeuhgHA@mail.gmail.com> <CADK3HHJo=bjA9z=ZBzk-vqxfu+0Eh4UmLd0WJUhngKAVYogz8w@mail.gmail.com> <005101d0a86a$f18ffe90$d4affbb0$@eu> <CAB=Je-G1+7x4LabgB6A4cF_RY0CV1RwbDryFXa0GioB_vg7o=g@mail.gmail.com> <60b20bb834cf54db8232239b9c27fcc2@imap.procolix.com> <CADK3HHLmYp34yxQzjEuGgsUW4+joghHZf+0FBr44K8i5hXA+BA@mail.gmail.com> <ba57c14862b915a79a69de9089df736e@imap.procolix.com> <CAB=Je-HbMx0+s_cuMk68P8v9EymT4UM18Y0aJKqnZCiivABfYw@mail.gmail.com> <2e15428aa0cf241e6cd9b951ba96140b@imap.procolix.com> <5d539d76f4ccb9a59abc57d5d99c4d92@imap.procolix.com> <006601d0a940$7a418620$6ec49260$@eu> <5c048c77d5a5e567790ab932f92fac12@imap.procolix.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox