X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1D8B98B9B37 for ; Fri, 11 Feb 2005 15:47:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02040-09 for ; Fri, 11 Feb 2005 15:46:45 +0000 (GMT) Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id 5BB7B8B9E29 for ; Fri, 11 Feb 2005 15:46:48 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J3b73.j.pppool.de [85.74.59.115]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id 7E372308C9; Fri, 11 Feb 2005 16:46:52 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id 25610165E64; Fri, 11 Feb 2005 16:46:47 +0100 (CET) Message-ID: <420CD366.8040603@logi-track.com> Date: Fri, 11 Feb 2005 16:46:46 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: "pgsql-jdbc@postgresql.org" , PostGIS Development Discussion , alex bodnaru Subject: PGConnection vs. Connection X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/97 X-Sequence-Number: 12277 [Crosspost to psql-jdbc, postgis-devel and alex bodnaru] Dear pgjdbc developers, When backporting toe PostGIS jdbc extension to debian woody (which still uses pgjdbc 7.2), Alex Bodnaru (PostGIS debian packager) stumbled over the fact that the addDataType() methods are carried by the org.postgresql.Connection class instead of the org.postgresql.PGConnection interface in 7.3 and up. An additional minor problem is that addDataType(String) is deprecated in 8.0 and this gives compiler warnings (and has the known class loader related problems). This problem is minor because the old method works as good as ever, and pgjdbc 8.0 provides the autoregistration via driverconfig.properties so we do not strictly need addDataType() calls at all in _most_ environments. We're currently wondering what the best method is for supporting 7.2, the following have come to our mind. - Prodiding a patch that is to be applied manually (rsp. by the debian package build process) when building for 7.2. (this is our "current practice"). - Using some kind of pgjdbc autorecognition and preprocessing (e. G. ant filters or C preprocessor). Because of the disadvantages regarding common Java IDEs (Syntax highlighting, error checking tools etc.) and the more complicated build process, I dislike the idea of introducing a separate preprocessing step in a Java project as small as PostGIS jdbc. But this is only my personal opinion, and you can convince me with appropriate arguments. - Manage two different source trees. - Using reflection. This could allow us per run-time distinction to use o.p.PGConnection.addDataType(Class) when running against pgjdbc 8.0, o.p.PGConnection.addDataType(String) against 7.3/7.4, and o.p.Connection.addDataType(String) against 7.2. This way we could ship a single postgis.jar that runs against all pgjdbc versions. - Using our own copy of PGConnection and Connection sources during our build process. We could then use conn.getClass().getName() or such to distinct which code to call, and encapsulate the actual code in functor objects that get instantiated lazy, so we only load the class that actually fits the real connection implementation (this should avoid classloader trouble). Which approach do you think to be the best one? Another question is whether it is worth the effort to develop any complicated scheme, as only a very few lines of code are actually affected. Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 zürich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com