Configuring GemFire XD as a JDBC Datasource

The GemFire XD JDBC implementation enables you to use a distributed system as an embedded JDBC datasource in products such as WebLogic Server.

Procedure

Follow this general procedure when setting up GemFire XD as a datasource in a third-party product:
  1. Copy the gemfirexdclient.jar file to the location where other JDBC drivers for the product are stored.
  2. For products such as WebLogic Server that provide datasource templates, select "Apache Derby," "User-defined," or "Other" as the database type if GemFire XD is not explicitly supported.
  3. Specify "gemfirexd" as the database name. This represents a single GemFire XD distributed system. (GemFire XD does not contain multiple databases as in Apache Derby or other relational database systems.)
  4. For the hostname and port, specify the hostname and port combination of a GemFire XD locator or a GemFire XD server. This is the same hostname and port combination you would use to connect as a client from the gfxd prompt.
  5. For the database username and password, enter a valid username and password combination if you have enabled authentication in your system (using the -auth-provider property).

    If you have not configured authentication in GemFire XD, specify "app" as both the username and password values, or any other temporary value.

    Note: GemFire XD uses the username specified in the JDBC connection as the schema name when you do not provide the schema name for a database object. GemFire XD uses "APP" as the default schema. If your system does not enable authentication, you can specify "APP" for both the username and password to maintain consistency with the default schema behavior.
  6. For the driver class, specify: com.pivotal.gemfirexd.internal.jdbc.ClientConnectionPoolDataSource
  7. The JDBC URL that you specify must begin with jdbc:gemfirexd://. Remove any template properties such as create=true if they are present in the URL or properties fields.
    In products such as WebLogic, you cannot specify JDBC connection properties for an embedded datasource as part of the JDBC URL. Instead, use the properties field and specify connectionAttributes using the format:
    connectionAttributes=attribute;attribute;...
    For example: connectionAttributes=mcast-address=239.192.81.1;mcast-port=10334 or connectionAttributes=locators=239.192.81.1;mcast-port=0

    See also the Apache Derby documentation for EmbeddedDataSource.

  8. A process can connect to only one GemFire XD distributed system at a time. If you want to connect to a different GemFire XD distributed system, shut down the current embedded data source before re-connecting with a different datasource.