Search code examples
postgresqlwebspherewebsphere-libertygreenplum

How to set a Greenplum datasource in IBM Liberty Server


I have an IBM WebSphere Liberty server and a Greenplum Database. I want liberty server to connect Greenplum with SSL.

Here is my setting in server.xml:

<dataSource id="GreenplumDataSource" jndiName="jdbc/greenplum" type="javax.sql.DataSource">
    <jdbcDriver libraryRef="GreenplumLib" javax.sql.DataSource="com.pivotal.jdbcx.GreenplumDataSource"/>
    <properties databaseName="postgres" serverName="10.x.x.1" portNumber="5432" user="x" password="x" URL="jdbc:pivotal:greenplum://10.x.x.1:5432;DatabaseName=postgres;EncryptionMethod=SSL;CryptoProtocolVersion=TLSv1.2;ValidateServerCertificate=false"/> 
</dataSource>
<library id="GreenplumLib">
    <file name="/data/IBM/WebSphere/Liberty/usr/lib/PROGRESS_DATADIRECT_JDBC_DRIVER_PIVOTAL_GREENPLUM_5.1.4.000275.jar"/>
</library>

A simple application uses this JNDI to connect Greenplum. And I get an error from the application:

Try to get connection : = jdbc/greenplum !!! Did not get the connection = java.sql.SQLInvalidAuthorizationSpecException: [Pivotal][Greenplum JDBC Driver][Greenplum]no pg_hba.conf entry for host "10.161.113.15", user "gpadmin", database "postgres", SSL off. DSRA0010E: SQL State = 28000, Error Code = 0

It seems the data source does not use SSL to connect Greenplum. Is there something wrong with my settings?


Solution

  • Thanks for your reply. I have fixed the issue. I set the wrong data source type and driver class before. Here is the correct setting:

    <dataSource id="GreenplumDataSource" jndiName="jdbc/greenplum" type="java.sql.Driver">
        <jdbcDriver libraryRef="GreenplumLib" javax.sql.DataSource="com.pivotal.jdbc.GreenplumDriver"/>
        <properties databaseName="postgres" serverName="10.x.x.1" portNumber="5432" user="x" password="x" URL="jdbc:pivotal:greenplum://10.x.x.1:5432;DatabaseName=postgres;EncryptionMethod=SSL;CryptoProtocolVersion=TLSv1.2;ValidateServerCertificate=false"/>
    </dataSource>