How to connect to Deephaven from another Java program

Included in this package are some classes that demonstrate how to connect to Deephaven and either run a query directly, or connect to an existing Persistent Query.

Note

Download Demo class files

Set up

These examples rely on some external resources, both to compile and to run.

  1. The contents of /usr/illumon/latest/java_lib from a Deephaven installation of the same version as the server you are connecting to. This will provide all of the necessary underlying jar files needed.

  2. The contents of a client-side Deephaven instance resources directory. This will contain all of the configuration files needed for a client to connect to the specified server.

    • On a Linux client, this will be under ~/iris/.programfiles/<instance name>/resources.
    • On a Windows client, this will be under %APPDATA%/Local/Illumon/<instance name>/resources.
  3. A configured private key for private key exchange. See instructions below.

  4. Several parameters passed into the Java command line:

    • -DConfiguration.rootFile=/path/to/your/iris-common.prop: This is the base configuration file, located in your resources directory from item #2. The client needs to know where to find this file.
    • -Dcom.fishlib.configuration.PropertyInputStreamLoader.override=com.fishlib.configuration.PropertyInputStreamLoaderTraditional: This instructs the client to use your local property files, and not to try to retrieve property files from etcd. This string should be entered exactly as it is depicted here.
    • WAuthenticationClientManager.defaultPrivateKeyFile=/path/to/your/key/priv-<iris user name>.base64.txt: This is the private key from item #3, entering the path as needed.
    • -Dtls.passphrase.file=/path/to/your/resources/truststore_passphrase: The TLS truststore passphrase information. Enter the absolute path here.
    • -Dtls.truststore=/path/to/your/resources/truststore-iris.p12: The TLS truststore itself. Enter the absolute path here.

Instructions for setting up private keys

Deephaven has a utility available on the server with your Deephaven installation for generating private keys for automated login.

  1. On the server you will be connecting to, run: /usr/illumon/latest/bin/generate-iris-keys <iris user name>.
  2. This will generate pub-<iris user name>.base64.txt and priv-<iris user name>.base64.txt on the server.
  3. On the server, append the contents of pub-<iris user name>.base64.txt to /etc/sysconfig/deephaven/auth/dsakeys.txt.
  4. On the server, restart the authentication service. If you are generating multiple keys, you only need to do this one time, after you have finished making changes to dsakeys.txt.
  5. Copy priv-<iris user name>.base64.txt to the client system that will be connecting to the server.