Configuring Avatica with Java

Avatica TLS server is distributed as a standalone JAR file.

To start an Avatica instance using Java, you will need:

After downloading the latest jar file from the releases page to a directory on your system, the Avatica server can be executed as follows:

java -cp "./*" "io.siren.avatica.TlsServer" <OPTIONS>

Supported options

The supported options are as follows:

  • -u: the JDBC URL of the datasource Avatica is connected to (e.g. jdbc:postgresql://postgres:5432/test). Note that credentials must not be set in the URL, as they will be specified by Avatica clients and passed through by the Avatica server.

  • --keystore: the path to a Java keystore or p12 bundle that contains a key and a certificate for the server.

  • --keystorePassword: the password of the keystore.

  • -s: the serialization format of Avatica requests; valid values are json and protobuf, defaults to protobuf.

  • --host: the IP address that the Avatica server will bind to (default to all addresses in the system).

  • -p: the port that the Avatica server will bind to (defaults to 8765).


Assuming that you want to connect to the test database of a PostgreSQL server already running at localhost:5432, you can follow these steps to start an Avatica instance using Java:

  1. Create a new directory named avatica and switch to it.

  2. Download the latest Avatica TLS server jar and the PostgreSQL JDBC Driver to the directory.

  3. Create a new directory named pki.

  4. Create a new self-signed certificate and its key by executing keytool as follows; set the password to password when asked:

    keytool -genkey \
      -keystore pki/avatica.p12 -storetype PKCS12 \
      -alias avatica \
      -keyalg RSA -keysize 2048 -sigalg SHA256withRSA \
      -validity 3650 \
      -dname CN=localhost -ext san=dns:localhost
  5. Start Avatica server as follows:

    java -cp "./*" "io.siren.avatica.TlsServer" \
      --host \
      --keystore pki/avatica.p12 \
      --keystorePassword password \
      -s json \
      -u "jdbc:postgresql://localhost:5432/test"

You should now be able to test that Avatica is connected to the PostgreSQL database by sending a raw connection opening request with curl:

curl -k https://localhost:8765 -H "Content-Type: application/json" -d '{
  "request": "openConnection",
  "connectionId": "123",
  "info": {
    "user": "test",
    "password": "password"

If the connection is successful, you will get back a JSON response containing the same value as request in the response field, for example:

  "response": "openConnection",
  "rpcMetadata": {
    "response": "rpcMetadata",

You can then stop the Avatica server by pressing CTRL+C.

Next steps

After starting an Avatica server, you will need to configure JDBC support in Siren Federate.