Re: [JDBC] Postgis example TestAutoregister is not working due tomissing getVersion() from pgjdbc community jar - Mailing list pgsql-jdbc

From Vladimir Sitnikov
Subject Re: [JDBC] Postgis example TestAutoregister is not working due tomissing getVersion() from pgjdbc community jar
Date
Msg-id CAB=Je-EYqpimEhBJUCkLB+Qwpn_s4enthU3Ko7WyM6V_idUEVw@mail.gmail.com
Whole thread Raw
In response to Re: [JDBC] Postgis example TestAutoregister is not working due tomissing getVersion() from pgjdbc community jar  (Fahar Abbas <fahar.abbas@enterprisedb.com>)
Responses Re: [JDBC] Postgis example TestAutoregister is not working due tomissing getVersion() from pgjdbc community jar  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Re: Postgis example TestAutoregister is not working due tomissing getVersion() from pgjdbc community jar  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
List pgsql-jdbc
I'm inclined to revert org.postgresql.Driver.getVersion and file a PR to PostGIS to avoid use of the method.

Vladimir

пт, 4 авг. 2017 г. в 9:18, Fahar Abbas <fahar.abbas@enterprisedb.com>:
Kindly let us know if this is expected behavior or not or we are
planning to fix in next pgjdbc release?


On Fri, Aug 4, 2017 at 10:04 AM, Fahar Abbas
<fahar.abbas@enterprisedb.com> wrote:
> We can not execute TestAutoregister due to missing getVersion under
> jdbc.jar file.
>
> On Fri, Aug 4, 2017 at 10:01 AM, Fahar Abbas
> <fahar.abbas@enterprisedb.com> wrote:
>> On Fri, Aug 4, 2017 at 9:51 AM, Dave Cramer <pg@fastcrypt.com> wrote:
>>> What do you need getVersion() for ?
>> https://mvnrepository.com/artifact/net.postgis/postgis-jdbc/2.1.7.2
>>
>> On the above link if we extract postgis-jdbc-2.1.7.2.jar and this
>> contain example TestAutoregister and getVersion is part of it.
>>
>>
>>>
>>> Note there are:
>>>
>>> @Override
>>> public int getMajorVersion() {
>>>   return org.postgresql.util.DriverInfo.MAJOR_VERSION;
>>> }
>>>
>>> @Override
>>> public int getMinorVersion() {
>>>   return org.postgresql.util.DriverInfo.MINOR_VERSION;
>>> }
>>>
>>>
>>>
>>> Dave Cramer
>>>
>>> davec@postgresintl.com
>>> www.postgresintl.com
>>>
>>> On 3 August 2017 at 21:44, Fahar Abbas <fahar.abbas@enterprisedb.com> wrote:
>>>>
>>>> Hi pgsql-jdbc community!
>>>>
>>>> Steps of EDB PostgreSQL9.6  installers download from EnterpriseDB website.
>>>>
>>>> ------
>>>> 1. Install JDK 7 on Linux 32 and Linux 64 and on mac install JDK 8
>>>> 2. Install pgjdbc and postgis from (PostgreSQL) StackBuilder
>>>> 3. Performs below commands from terminal:
>>>>
>>>> For Linux:
>>>> ------------
>>>> export JAVA_HOME=/usr/local/jdk1.7.0_51/bin/java
>>>> export PATH=/usr/local/jdk1.7.0_51/bin:$PATH
>>>> export
>>>> CLASSPATH=.:/opt/PostgreSQL/pgJDBC/postgresql-42.1.3.jre6.jar:/opt/PostgreSQL/9.6/PostGIS/java/jdbc/postgis-jdbc-2.1.7.2.jar:$CLASSPATH
>>>> export
>>>> CLASSPATH=.:/opt/PostgreSQL/pgJDBC/postgresql-42.1.3.jre7.jar:/opt/PostgreSQL/9.6/PostGIS/java/jdbc/postgis-jdbc-2.1.7.2.jar:$CLASSPATH
>>>>
>>>> For MAC:
>>>> ----------
>>>> export JAVA_HOME="/Library/Internet\
>>>> Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
>>>> export PATH="/Library/Internet\
>>>> Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/":$PATH
>>>> export
>>>> CLASSPATH=.:/Library/PostgreSQL/pgJDBC/postgresql-42.1.3.jar:/Library/PostgreSQL/9.6/PostGIS/java/jdbc/postgis-jdbc-2.1.7.2.jar:$CLASSPATH
>>>> export
>>>> CLASSPATH=.:/Library/PostgreSQL/pgJDBC/postgresql-42.1.3.jre6.jar:/Library/PostgreSQL/9.6/PostGIS/java/jdbc/postgis-jdbc-2.1.7.2.jar:$CLASSPATH
>>>> export
>>>> CLASSPATH=.:/Library/PostgreSQL/pgJDBC/postgresql-42.1.3.jre7.jar:/Library/PostgreSQL/9.6/PostGIS/java/jdbc/postgis-jdbc-2.1.7.2.jar:$CLASSPATH
>>>>
>>>> 4. Connect psql with postgres database.
>>>>
>>>> 5. <PG_HOME>/bin/psql -d postgres -p 5432
>>>>
>>>> 6. Create Postgis Extensions.
>>>>
>>>> CREATE EXTENSION Postgis;
>>>> CREATE EXTENSION Postgis_topology;
>>>> CREATE EXTENSION fuzzystrmatch;
>>>> CREATE EXTENSION Postgis_tiger_geocoder;
>>>>
>>>> 7. Verify installed postgis extensions version through psql commands.
>>>>
>>>> SELECT postgis_version();
>>>> SELECT postgis_full_version();
>>>> SELECT postgis_lib_build_date();
>>>> SELECT postgis_scripts_installed();
>>>>
>>>> 8. extract postgis-jdbc-2.1.7.2.jar file through jar xf
>>>> 9. Now execute the example files and execute following query:
>>>>
>>>> java examples/TestAutoregister
>>>> jdbc:postgresql://localhost:5432/postgres postgres postgres
>>>>
>>>> Expected Result:
>>>> ----------------
>>>> Postgis jar Example executed successfully.
>>>>
>>>> Output:
>>>>
>>>> java examples/TestAutoregister
>>>> jdbc:postgresql://localhost:5432/postgres postgres postgres
>>>> Testing proper auto-registration
>>>> Driver version: PostgreSQL 9.4 JDBC4.1 (build 1206)
>>>> Creating JDBC connection to jdbc:postgresql://localhost:5432/postgres
>>>> PostGIS Version: 2
>>>> PGgeometry successful!
>>>> Box3d successful!
>>>> Box2d successful!
>>>> Finished.
>>>> TestAutoregister.java finished without errors.
>>>>
>>>> Actual Result:
>>>> --------------
>>>> java examples/TestAutoregister
>>>> jdbc:postgresql://localhost:5432/postgres postgres postgres
>>>> Testing proper auto-registration
>>>> Exception in thread "main" java.lang.NoSuchMethodError:
>>>> org.postgresql.Driver.getVersion()Ljava/lang/String;
>>>> at examples.TestAutoregister.main(TestAutoregister.java:64)
>>>> ------------
>>>>
>>>> After complete investigation, I observed that getVersion information
>>>> has been removed under community 42.jdbc.jar file however in
>>>> postgis-jdbc-2.1.7.2.jar, we are still using getVersion.
>>>>
>>>> We(EDB PostgreSQL team) released last postgis-pg96-2.3.2-1 version on
>>>> 15-Feb-2017 while community jdbc team removed getVersion from JDBC jar
>>>> file from PostgreSQL JDBC Driver 42.0.0 version on
>>>> 19-Feb-2017.(https://jdbc.postgresql.org/)
>>>>
>>>>
>>>> Please note that we are shipping pgjdbc driver from
>>>> https://jdbc.postgresql.org/download.html while postgis jdbc jar under
>>>> this location:
>>>> https://mvnrepository.com/artifact/net.postgis/postgis-jdbc/2.1.7.2
>>>>
>>>> Please note that on 9.4.1212 version getVersion information is
>>>> available but not available on 42.jdbc.jar file
>>>>
>>>> Kindly let us know if we are planning to fix that issue or not and we
>>>> will modify our postgis accordingly?
>>>>
>>>> Kind Regards,
>>>> --
>>>> Fahar Abbas
>>>> QMG
>>>> EnterpriseDB Corporation
>>>>
>>>>
>>>> --
>>>> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
>>>> To make changes to your subscription:
>>>> http://www.postgresql.org/mailpref/pgsql-jdbc
>>>
>>>
>>
>>
>>
>> --
>> Fahar Abbas
>> QMG
>> EnterpriseDB Corporation
>
>
>
> --
> Fahar Abbas
> QMG
> EnterpriseDB Corporation



--
Fahar Abbas
QMG
EnterpriseDB Corporation


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

pgsql-jdbc by date:

Previous
From: Fahar Abbas
Date:
Subject: Re: [JDBC] Postgis example TestAutoregister is not working due tomissing getVersion() from pgjdbc community jar
Next
From: Vladimir Sitnikov
Date:
Subject: [JDBC] [pgjdbc/pgjdbc] 50d5dd: fix: reintroduce Driver.getVersion forbackward co...