Skip to main content

Using an External Database

It is possible to use your own external database with Stirling PDF rather than the default H2 database if you wish. PostgreSQL is currently the only supported variant, others will be added on request.

Setting Up External Database Configuration

You can configure the new Datasource property in your settings.yml to connect to your external database:

⚠️ Note

To use the external database feature, you will need to have a valid enterprise license and set the environment variable DOCKER_ENABLE_SECURITY to true.

  datasource:
enableCustomDatabase: false
customDatabaseUrl: jdbc:postgresql://localhost:5432/postgres
username: postgres
password: postgres
type: postgresql
hostName: localhost
port: 5432
name: postgres
  • enableCustomDatabase: Set this property to true to enable use of the custom database Note: An enterprise license to use this feature
  • customDatabaseUrl: Enter the database connection url for the database here. Note: If you set the customDatabaseUrl you do not need to set the type, hostName, port and name, they will all be automatically derived from the url.
  • username: The username for the database
  • password: The password for the database

If you would like more fine-grained control of the database connection, you can also use the following properties:

Fine-grained Database Configuration

  • type: The database type. Available options are h2 and postgresql
  • hostName: The host name of the database connection url (e.g. 'localhost')
  • port: The port number of the database connection url (e.g. 8080)
  • name: The name of the custom database. This should match the name you have set for your database

Example configuration can be found in exampleYmlFiles/docker-compose-latest-fat-security-postgres.yml