Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5TRm-0006TK-TX for pgsql-jdbc@arkaria.postgresql.org; Thu, 18 Jun 2015 06:37:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z5TRl-0002lx-JX for pgsql-jdbc@arkaria.postgresql.org; Thu, 18 Jun 2015 06:37:09 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z5TRk-0002kg-Jw for pgsql-jdbc@postgresql.org; Thu, 18 Jun 2015 06:37:08 +0000 Received: from smtp.procolix.com ([95.215.185.30]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Z5TRi-00035d-4j for pgsql-jdbc@postgresql.org; Thu, 18 Jun 2015 06:37:07 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.procolix.com (Postfix) with ESMTP id D361743DA4 for ; Thu, 18 Jun 2015 08:37:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at smtp.procolix.com Received: from smtp.procolix.com ([127.0.0.1]) by localhost (host436.procolix.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RrNgoN3P7ofs for ; Thu, 18 Jun 2015 08:37:04 +0200 (CEST) Received: from webmail.procolix.com (webmail.procolix.com [95.215.185.106]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mark@lawinegevaar.nl) by smtp.procolix.com (Postfix) with ESMTPSA id 23D4E43D84 for ; Thu, 18 Jun 2015 08:37:04 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: Thu, 18 Jun 2015 08:37:04 +0200 From: Mark Rotteveel To: List Subject: Re: Pre-processing during build In-Reply-To: <006601d0a940$7a418620$6ec49260$@eu> References: <000c01d0a7b6$97571ee0$c6055ca0$@eu> <005101d0a86a$f18ffe90$d4affbb0$@eu> <60b20bb834cf54db8232239b9c27fcc2@imap.procolix.com> <2e15428aa0cf241e6cd9b951ba96140b@imap.procolix.com> <5d539d76f4ccb9a59abc57d5d99c4d92@imap.procolix.com> <006601d0a940$7a418620$6ec49260$@eu> Message-ID: <5c048c77d5a5e567790ab932f92fac12@imap.procolix.com> X-Sender: mark@lawinegevaar.nl User-Agent: RoundCube Webmail/0.2 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org On Wed, 17 Jun 2015 22:59:18 +0200, "Markus KARG" 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