# Databases

- Link: https://www.agilicus.com/anyx-guide/databases/
- Published: 2025-06-05T18:57:35+00:00
- Author: Don Bowman

1. [Home](https://www.agilicus.com/)
 2. Databases

![databases](https://www.agilicus.com/www/4eb49955-databases.svg)

## Databases

Use remote database applications like QField

[CONTACT](https://www.agilicus.com/contact-us/)

## Overview

Some applications directly read from a database without an intermediate API layer.
An example is [QField](https://qfield.org/), a GIS application for mobile devices,
directly reaching a Postgresql database.

For applications that use a text-based template file as their method of finding 
the database (e.g. XML, .ini, etc.) fetched over a network, this feature will enrich/
modify the template file in real time with an appropriate credential for the user,
allowing direct access to the database without an open firewall.

There are two components to the usage:

 1. (Admin) setup the template
 2. (End-user) use Profile to download a custom-version of the template for each user,
    opening in their application

End-users will see a seamless experience on their device: their application will
appear as if on the LAN with the database.

Administrators will see a secure experience for the end-user: multi-factor, per-
user credentials, no database credentials shared externally.

### Admistrative Setup

High Level Steps:

 1. Create ‘Database’ resource
 2. Modify your connection file / template
 3. Create a ‘Template’ with the modified file

#### Create Database Resource

![image](https://www.agilicus.com/www/f3cbef46-image-1024x711.png)

![image](https://www.agilicus.com/www/a1335868-image-1024x668.png)

![image](https://www.agilicus.com/www/b6329f52-image-1024x562.png)

![image](https://www.agilicus.com/www/6e315c3e-image-1024x636.png)

At this stage, the database resource is ready. You are prompted for a set of common
actions (assign permissions, create a template). No one (including you the admin)
will be able to use it without permissions assigned.

The options include:

 1. Create a template. We will do this below in another step, but you may feel free
    to do it here
 2. Add to one or more resource groups. You will commonly have multiple resources that
    behave as a single entity (e.g. a web application + database combination)
 3. Assign permissions: give a single user, or a group of users the ability to use 
    this Database from Profile (e.g. on their device)
 4. Assign (access) policies such as specific multi-factor or geographical restrictions

#### Modify Existing Template

These instructions will vary on a per application basis. Essentially, you have 3
fields somewhere in the connection/template file you need to modify. These are:

 * ${user.email} — replace the built-in user (which is usually the database username)
   with this string
 * ${api_key} — replace the built-in password with this string
 * ${resource.uri.domain} — replace the built-in hostname with this string. If there
   is a port number (e.g. 5432 for Postgresql) change this to 443.

An example might look like this:

    ```has-small-font-size
    username: ${user.email}
    password: ${api_key}
    host: ${resource.uri.domain}:443
    ```

You may do these through the GUI of the database application, or, via a text editor.

#### Create Template

![image](https://www.agilicus.com/www/0136a19d-image-1024x740.png)

At this stage you should upload the template you modified above:

![image](https://www.agilicus.com/www/48f98e42-image-1024x622.png)

You will now be given the opportunity to name it (usually this is not seen by the
user, but, the extension might be used) and to give it a MIME type (this might be
used by your application to automatically find/open).

![ANYx Database Connectivity Architecture: Diagram illustrating ANYx's role as a
secure data gateway, connecting users and applications to various databases (SQL,
NoSQL, cloud-based) with identity-based access control and data masking. Shows data
flowing through ANYx, ensuring compliance and preventing unauthorized access.](https://
www.agilicus.com/www/7c22616b-image.png)

Now associate the template with the Database we created above:

![image](https://www.agilicus.com/www/d6996451-image-1024x518.png)

Now apply. At this stage, the user(s) who you have given permission should see an
icon for the database name in https://profile.__MYDOMAIN__, and, if they select 
it, should download the template file with those fields filled in.

Testing this file, I obtained:

    ```wp-block-code
    username: db@XXXXX.ca
    password: 4xnyXXXXXX46rdfw
    host: postgis.databases.r.XXXXX.ca:443
    ```
