Can't find valid JDBC driver when deploying Liberty app in Bluemix with ElephantSQL Can't find valid JDBC driver when deploying Liberty app in Bluemix with ElephantSQL postgresql postgresql

Can't find valid JDBC driver when deploying Liberty app in Bluemix with ElephantSQL


For using PostgreSQL (which is the JDBC driver used by ElephantSQL) you need to specify your datasource implementation class name on your <jdbcDriver> element:

<jdbcDriver id="myDerbyJDBCdriver" javax.sql.DataSource="org.postgresql.ds.PGPoolingDataSource">  <!-- keep nested stuff the same --></jdbcDriver>

The reason you need to specify the DataSource impl class for PostgreSQL but not for Derby is because Derby is a "known" database to Liberty, but PostgreSQL.

I'll let Liberty development know about this so PostgreSQL can be added as a "known" database sometime in the future.


The exception reported states the following:

A valid JDBC driver implementation class was not found for the jdbcDriver jdbcDriver[myDerbyJDBCdriver]

This exception is saying that it is unable to locate the Connection Pooling DataSource class within the postgresql-jdbc-9.4.1209.jar.

WLP is working as design and requires additional configuration in the server.xml since WLP is only able to locate the implementation classes for a certain number of known databases[1]. I reviewed the postgresql-jdbc-9.4.1209.jar driver and found the implementation class as the following:

org.postgresql.ds.PGPoolingDataSource

You should update the server.xml file with the following:

javax.sql.DataSource="org.postgresql.ds.PGPoolingDataSource"

[1]https://www.ibm.com/support/knowledgecenter/was_beta_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/twlp_dep_configuring_ds.html