JDBC Driver for Greenplum

Build 24.0.9060

Establishing a Connection

Creating a JDBC Data Source

You can create a JDBC data source to connect from your Java application. Creating a JDBC data source based on the CData JDBC Driver for Greenplum consists of three basic steps:

  • Add the driver JAR file to the classpath. The JAR file is located in the lib subfolder of the installation directory. Note that the .lic file must be located in the same folder as the JAR file.
  • Provide the driver class. For example:
    cdata.jdbc.greenplum.GreenplumDriver
  • Provide the JDBC URL. For example:
    jdbc:greenplum:User=user;Password=admin;Database=dbname;Server=127.0.0.1;Port=5432
    
    or
    
    jdbc:cdata:greenplum:User=user;Password=admin;Database=dbname;Server=127.0.0.1;Port=5432

    The second format above can be used whenever there is a conflict in your application between drivers using the same URL format to ensure you are using the CData driver. The URL must start with either "jdbc:greenplum:" or "jdbc:cdata:greenplum:" and can include any of the connection properties in name-value pairs separated with semicolons.

Connecting to Greenplum

To connect to Greenplum, set the Server, Port (the default port is 5432), and Database connection properties and set the User and Password you want to use to authenticate to the server. If the Database property is not specified, the driver connects to the user's default database (it is the same name as the user).

Authenticating to Greenplum

The CData JDBC Driver for Greenplum supports the md5, password, Kerberos and SASL (particulary, SCRAM-SHA-256) authentication methods.

The specific authentication method is setup in the pg_hba.conf file on the Greenplum Server. You can find instructions about authentication setup on the Greenplum Server here. The md5, password and SASL authentication methods do not require additional setup by the CData JDBC Driver for Greenplum.

Kerberos

The Greenplum Server initiates authentication with the Kerberos Server when the CData JDBC Driver for Greenplum attempts a connection. You need to setup Kerberos on the Greenplum Server to activate this authentication method. After you have Kerberos authentication setup on the Greenplum Server, see Using Kerberos for details on how to authenticate with Kerberos by the driver.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060