Using the JDBCRowLoader Example

The JDBCRowLoader class provide a sample RowLoader implementation that loads data from archive relational data stores.

Features and Requirements

The JDBCRowLoader example has the following features:
  • It can be implemented for any JDBC data source (provided the driver is available in the classpath of the server)
  • It can be implemented for any table, although a separate instance of the RowLoader is created for each table.
  • It pools JDBC Connections and PreparedStatements, with a configurable minimum and maximum number of connections.
  • It uses the Connection.isReadOnly(true) setting to request that the driver optimize the transaction settings for database reads.

A query-string parameter is passed to the JDBCRowLoader to tell it what SQL statement to use against the archive database. This is a required parameter.

If the column layout of the archive table matches the column layout of the GemFire XD table, you can use SELECT * in the query string.

If the column layout of the archive table does not match the column layout of the GemFire XD table, you must explicitly provide and order the column names in the SELECT statement so that the result set matches the layout of the GemFire XD table.

There is no requirement that the schema or table name in GemFire XD match the schema and/or table name in the archive database.

The elements of the primary key are passed into the JDBCRowLoader when it is invoked, in the order that the columns are defined in the GemFire XD table. They will be passed as parameters into the PreparedStatement in that order, so you must structure the WHERE clause of the query-string so that the elements are passed in the correct order.

Accepted parameters with examples:
  • url=jdbc:oracle:thin:@localhost:1521:XE (required)
  • query-string=SELECT * FROM LoaderArchive WHERE id=? AND name=? (required)
  • user=app
  • password=app
  • min-connections=1
  • max-connections=5
  • connection-timeout=3000 (milliseconds)

All properties are also passed to the JDBC connection when it is created.

JDBCRowLoader Example Implementation

GemFire XD installs a sample JDBCRowLoader implementation in Pivotal_GemFireXD_10_bNNNNN/examples/ Note that this example requires gemfire.jar (from the Pivotal GemFire product) in order to run.