PGX 21.1.1

Loading Graphs from a Database

PGX supports loading graph data from an Oracle database and Elasticsearch in the following formats:

Additionally, PGX supports the database and Elasticsearch as a data provider for partitioned graph loading by using the rdbms and es format in a provider configuration.

In order for PGX to be able to read the data in the database and Elasticsearch, you need to provide suitable credentials with permissions to access the data. Since version 19.3.0, PGX uses a keystore to handle credentials.

Configuring Database Credentials with a Keystore

The first step is saving your database password in a keystore. The following example generates a new keystore using the standard keytool CLI, which is bundled with the JDK.


# Add a password for the 'database1' connection
keytool -importpass -alias database1 -keystore keystore.p12
# 1. Enter the password for the keystore
# 2. Enter the password for the database

# Add another password (for the 'database2' connection)
keytool -importpass -alias database2 -keystore keystore.p12

# List what's in the keystore using the keytool
keytool -list -keystore keystore.p12

Keystore format

If you are using Java <=8, you should pass the additional parameter -storetype pkcs12 to the keytool commands in the example above.

Once the password is saved in the keystore, you can use its alias (e.g., database1 or database2 in the example above) to let PGX retrieve it.

First, you should register the keystore to the session that will be loading the graph through the registerKeystore(keystorePath, keystorePassword) API. The keystorePath parameter refers to a path on the client side, where the keystore with the desired password is located. The keystorePassword parameter is the password to unlock the keystore.

Once the keystore is registered to a session, that session can load graph data from the database by pointing to the keystore alias in the graph config, as the following excerpt shows.

  "jdbc_url": "jdbc:oracle:thin:@localhost:1521:rdbmsod",
  "format": "two_tables",
  "datastore": "rdbms",
  "username": "scott",
  "keystore_alias": "database1",
  "edge_props": [{
     "name": "EPROP0",
     "type": "int"

For the Elasticsearch, use es_url in place of jdbc_url as follows.

PGX supports the partitioned graph loading only for the Elasticsearch.

  "es_url": "http://elastic_domain:9200",
  "username": "john",
  "keystore_alias": "elastic_domain_user",
  "vertex_providers": [ ... ] ,
  "edge_providers": [ ... ]