Re: Problem updating driver to 42.0.0 - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: Problem updating driver to 42.0.0
Date
Msg-id CADK3HHKSPbf94tsKbD_PnVVo7Ly6SyikOv_eX2e0rZxJgVik0Q@mail.gmail.com
Whole thread Raw
In response to Re: [JDBC] Problem updating driver to 42.0.0  (Bogdan Daniliuc <bdaniliuc@montran.com>)
List pgsql-jdbc
Hi Bogdan,

Thanks for this!


On 6 March 2017 at 03:23, Bogdan Daniliuc <bdaniliuc@montran.com> wrote:
Hi Dave,

There is a WebSphere variable defined, POSTGRES_JDBC_DRIVER_PATH pointing to that folder. The JDBC provider is then defined having the database class path information either ${POSTGRES_JDBC_DRIVER_PATH}/postgresql-9.4.1212.jar or ${POSTGRES_JDBC_DRIVER_PATH}/postgresql-42.0.0.jar.

The folder contains only the corresponding JAR file to eliminate any interference.

I performed additional experiments, based on the assumption that this is a class loader issue. After we added in org.postgresql.ds.common.BaseDataSource the following code (that is present in 9.4.12121 but not in 42.0.0), the driver worked:

    static {
        try {
          Class.forName("org.postgresql.Driver");
        } catch (ClassNotFoundException e) {
          System.err.println("PostgreSQL DataSource unable to load PostgreSQL JDBC Driver");
        }
      }

I'm not sure if this is the correct fix.

Thank you,

Bogdan Daniliuc



Hi Bogdan

How would websphere find it if was in c:\driver 

I'm sort of clue free here ?


On 3 March 2017 at 04:40, Bogdan Daniliuc <bdaniliuc@montran.com> wrote:
Hello,

We are encountering an error when trying to update the driver from postgresql-9.4.1212 to postgresql-42.0.0 in WebSphere 8.5.5

With 42.0.0, we get:

Failed to create a ConnectionPoolDataSource from PostgreSQL JDBC Driver 42.0.0 for testDB at jdbc:postgresql://localhost:5432/testDB: java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/testDB

DSRA8201W: DataSource Configuration: DSRA8040I: Failed to connect to the DataSource DS2.  Encountered java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/testDB DSRA0010E: SQL State = 08001, Error Code = 0.
java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/testDB DSRA0010E: SQL State = 08001, Error Code = 0
    at java.sql.DriverManager.getConnection(DriverManager.java:700)
    at java.sql.DriverManager.getConnection(DriverManager.java:258)
    at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:79)
    at org.postgresql.ds.PGConnectionPoolDataSource.getPooledConnection(PGConnectionPoolDataSource.java:69)


The driver is in a c:\driver directory. It works if the driver is moved in AppServer\java_1.8_64\jre\lib\ext, but this is not recommended by IBM.

9.2.1212 and 1211 all work when placed in the same directory.

Thank you,

Bogdan



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



-- 

___________________________________________________________
This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accordance with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except with formal written approval. The sender cannot guarantee the integrity of this message. Montran Corporation (and its subsidiaries) shall not therefore be liable for the message if modified.

pgsql-jdbc by date:

Previous
From: Bogdan Daniliuc
Date:
Subject: Re: Problem updating driver to 42.0.0
Next
From: Vladimir Sitnikov
Date:
Subject: Re: [JDBC] [HACKERS] Statement-level rollback