HAWQ Database Drivers and APIs

You may want to connect your existing Business Intelligence (BI) or Analytics applications with HAWQ. The database application programming interfaces most commonly used with HAWQ are the Postgres and ODBC and JDBC APIs.

HAWQ provides the following connectivity tools for connecting to the database:

  • ODBC driver
  • JDBC driver
  • libpq - PostgreSQL C API

HAWQ Drivers

ODBC and JDBC drivers for HAWQ are available as a separate download from Pivotal Network Pivotal Network.

ODBC Driver

The ODBC API specifies a standard set of C interfaces for accessing database management systems. For additional information on using the ODBC API, refer to the ODBC Programmer’s Reference documentation.

HAWQ supports the DataDirect ODBC Driver. Installation instructions for this driver are provided on the Pivotal Network driver download page. Refer to HAWQ ODBC Driver for HAWQ-specific ODBC driver information.

Connection Data Source

The information required by the HAWQ ODBC driver to connect to a database is typically stored in a named data source. Depending on your platform, you may use GUI or command line tools to create your data source definition. On Linux, ODBC data sources are typically defined in a file named odbc.ini.

Commonly-specified HAWQ ODBC data source connection properties include:

Property Name Value Description
Database Name of the database to which you want to connect.
Driver Full path to the ODBC driver library file.
HostName HAWQ master host name.
MaxLongVarcharSize Maximum size of columns of type long varchar.
Password Password used to connect to the specified database.
PortNumber HAWQ master database port number.

Refer to Connection Option Descriptions for a list of ODBC connection properties supported by the HAWQ DataDirect ODBC driver.

Example HAWQ DataDirect ODBC driver data source definition:

[HAWQ-201]
Driver=/usr/local/hawq_drivers/odbc/lib/ddgplm27.so
Description=DataDirect 7.1 Greenplum Wire Protocol - for HAWQ
Database=getstartdb
HostName=hdm1
PortNumber=5432
Password=changeme
MaxLongVarcharSize=8192

The first line, [HAWQ-201], identifies the name of the data source.

ODBC connection properties may also be specified in a connection string identifying either a data source name, the name of a file data source, or the name of a driver. A HAWQ ODBC connection string has the following format:

([DSN=<data_source_name>]|[FILEDSN=<filename.dsn>]|[DRIVER=<driver_name>])[;<attribute=<value>[;...]]

For additional information on specifying a HAWQ ODBC connection string, refer to Using a Connection String.

JDBC Driver

The JDBC API specifies a standard set of Java interfaces to SQL-compliant databases. For additional information on using the JDBC API, refer to the Java JDBC API documentation.

HAWQ supports the DataDirect JDBC Driver. Installation instructions for this driver are provided on the Pivotal Network driver download page. Refer to HAWQ JDBC Driver for HAWQ-specific JDBC driver information.

Connection URL

Connection URLs for accessing the HAWQ DataDirect JDBC driver must be in the following format:

jdbc:pivotal:greenplum://host:port[;<property>=<value>[;...]]

Commonly-specified HAWQ JDBC connection properties include:

Property Name Value Description
DatabaseName Name of the database to which you want to connect.
User Username used to connect to the specified database.
Password Password used to connect to the specified database.

Refer to Connection Properties for a list of JDBC connection properties supported by the HAWQ DataDirect JDBC driver.

Example HAWQ JDBC connection string:

jdbc:pivotal:greenplum://hdm1:5432;DatabaseName=getstartdb;User=hdbuser;Password=hdbpass

libpq API

libpq is the C API to PostgreSQL/HAWQ. This API provides a set of library functions enabling client programs to pass queries to the PostgreSQL backend server and to receive the results of those queries.

libpq is installed in the lib/ directory of your HAWQ distribution. libpq-fe.h, the header file required for developing front-end PostgreSQL applications, can be found in the include/ directory.

For additional information on using the libpq API, refer to libpq - C Library in the PostgreSQL documentation.