Re: [JDBC] old JDBC driver (8.1-JDBC3) can connect to postgresql 9.x ?

Поиск
Список
Период
Сортировка
От Jorge Solórzano
Тема Re: [JDBC] old JDBC driver (8.1-JDBC3) can connect to postgresql 9.x ?
Дата
Msg-id CA+cVU8Mfphd7P=7E9ZNpLPHk4EaN05VNLRmSsfMfAetgYvYQxg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [JDBC] old JDBC driver (8.1-JDBC3) can connect to postgresql 9.x ?  ("itoshun001@efeel.to" <itoshun001@efeel.to>)
Ответы Re: [JDBC] old JDBC driver (8.1-JDBC3) can connect to postgresql 9.x ?  ("itoshun001@efeel.to" <itoshun001@efeel.to>)
Re: old JDBC driver (8.1-JDBC3) can connect to postgresql 9.x ?  ("itoshun001@efeel.to" <itoshun001@efeel.to>)
Список pgsql-jdbc

On Mon, Jan 16, 2017 at 6:05 PM, itoshun001@efeel.to <itoshun001@efeel.to> wrote:
Hi Jorge

Thank you for your accurate answers and kind understanding for our situation.
Now I understand below and these info is very useful for our team !

  - the old driver(8.1-404 JDBC3) technically can connect to postgresql 9.3 but some new features should not be available, and we won't get the bugfixes of later version.

​Yes technically, but as John points out ​you could hit a schema catalog change so while it *might* work, there is a chance to hit a problem with pg_catalog updates, the pg_catalog is an internal postgresql table that contains many info consumed by the pgjdbc driver and newer versions of the driver can handle all these variations, so for instance the pgjdbc driver 9.3 Build 1103 can connect without problems to older postgresql versions like the one you are using (8.3) and it can connect to newer postgresql versions like 9.3.

For many years the pgjdbc driver followed the versions of the server to declare some kind of compatibility, basically it means that the version you are using (8.1-404 JDBC3) was essentially for postgresql 8.1 and older, but you are using it for postgresql 8.3 and it works (for you). From the version 9.4.x of the driver that is no longer the case, and the current version 9.4.1212 works on PostgreSQL 9.6 too.

 

  - the driver should be highly compatible with earlier versions, and if our web app is using standard jdbc, then it should be practically transparent the change (we don't even need to recompile).

Yes, it should work for postgresql 8.3 and postgresql 9.3 (and everything between) that means that you should be using (based on the Java 5 version) the PgJDBC 9.3 Build 1103 and not the 8.1-404, but as I said before, always test for potential regressions.

 

One more question which might be last question....

  (Q) My understanding below is correct ??

      Versions of jdbc driver that supported Java 5 can't connect to postgresql 9.4 or later 
      because 
       - the versions of jdbc driver don't support JDBC 4, 41 and 42
       - the versions of postreqsql don't support JDBC3

​​Let me be cristal clear​, it *might* work ​but again, you might hit a problem with pg_catalog updates and others compatibility issues, so is NOT recomeded to use an older driver version to connect to a newer postgresql version, you should always try to use the latest driver. For example I have a web app that is still on PostgreSQL 9.1 but it's using the latest driver version 9.4.1212. What I mean is that is better to have a new jdbc driver connecting to an older postgresql instance than the opposite.

To clarify your points, PostgreSQL knows nothing about Java or JDBC, the PgJDBC driver is a pure Java driver that implements the native protocol of PostgreSQL, so PgJDBC "talks" in the PostgreSQL native language (the binary or text protocol that postgres understand). So when a new version of PostgreSQL comes out, the driver has to "understand" the new or changed stuff so an older version of the driver do not recognize the changed stuff and there might hit a compatibility issue.

And as John said, Java 5 is obsolete, my recomendation is to try upgrading the Java version, at least to Java 6, Java is for the most part backward compatible, so you can use a new Java Runtime for a Java 5 compiled app.

Then try to update the PgJDBC driver to the latest version, and finally try to upgrade the PostgreSQL server to a supported version.

As always, test, test and do more test for any potential problem.

 

Best regards,
itoshun

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: old JDBC driver (8.1-JDBC3) can connect to postgresql 9.x?
Следующее
От: "itoshun001@efeel.to"
Дата:
Сообщение: Re: [JDBC] old JDBC driver (8.1-JDBC3) can connect to postgresql 9.x ?