Connecting to Databases

If your database can be made accessible to the Internet, you can use the various [Database.Xxx:] macros to directly include data in your report.

If your database cannot be made available to our servers, you will need to install a ReportMagic agent behind your firewall and instead use the different [Agent.SqlXxx:] macros instead.Please complete a feedback/support ticket if you require more guidance.

To set up a database connection:

  1. Ensure that your database is accessible from our public IP range: 46.249.212.128/27
  2. From the Admin menu, click Connections.
  3. Click the Create button and choose to add a Database connection.
  4. Enter a name - we recommend that you use "Default" for the name of the first connection of each type, and optionally, a description.
  5. Set:
    • URL: the hostname of your database, for example "my.database.windows.net"
    • Username: the username to use to connect
    • Password: the password to use to connect
    • Configuration: as below
  6. The Configuration section should be JSON text as follows:
{
   "Type": "<OPTIONAL: the database type. Either MsSql or Postgres (defaults to MsSql)>",
   "Name": "<MANDATORY: the database name>",
   "Port": "<OPTIONAL integer: port number (defaults to 5432 for Postgres, 1433 for MsSql)>",
   "TimeoutMs": "<OPTIONAL integer: the default query timeout to use in milliseconds>",
   "ConnectTimeoutSeconds": "<OPTIONAL integer: the time in seconds, (defaults to 15) to wait for a connection to open>",
   "Encrypt": "<OPTIONAL boolean: whether to enable encrypted connections to the database>",
   "TrustServerCertificate": "<OPTIONAL boolean: indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust>",
   "SqlServerAuthenticationMethod": "<OPTIONAL string: Valid values: NotSpecified, SqlPassword, ActiveDirectoryPassword, ActiveDirectoryIntegrated, ActiveDirectoryInteractive, ActiveDirectoryServicePrincipal, ActiveDirectoryDeviceCodeFlow, ActiveDirectoryManagedIdentity, ActiveDirectoryMSI, ActiveDirectoryDefault or ActiveDirectoryWorkloadIdentity>"
}

For the optional properties, you may omit them, and they will take the default values. In the case of "ConnectTimeoutSeconds", "Encrypt" and "TrustServerCertificate", when omitted they will NOT be added to the connection string and so will take the defaults defined by the database type.

  • For more information on "ConnectTimeoutSeconds", click here.
  • For more information on "Encrypt", click here.
  • For more information on "TrustServerCertificate", click here.

An unhandled error has occurred. Reload 🗙