Skip to content

Enabling the Database Sync

The database sync feature allows you to view your civilian and vehicle data in real time inside the MDT. Once setup, this feature will be available for all services of your community.

As a community owner, you can enable the database sync feature by following these steps.

TIP

Please note that the MDT is a feature available on the OnClock Premium plan. You can set up the database sync feature for your community, but only premium services will have access to it through the MDT.

Officially Supported Frameworks

The database sync feature is compatible with any games or frameworks using a MySQL or MariaDB database.

We also provide built-in support for the following FiveM frameworks with customizable options:

Open the Community Settings

  1. On the community selection page, click the gear icon next to your community name.

    Community Selection Page
  2. Click the "Database Sync" tab.

    Community Settings Page

Set Up the Database Connection

  1. Click "Get Started" to begin the setup process.

    Get Started
  2. In the Host field, enter the domain name or IP address of your database server.

  3. On your database server, create a new username and a strong password.

    WARNING

    Your password is stored securely and encrypted, but we recommend using a read-only user with the minimum required permissions. We also recommend restricting connections to our servers only.

    You can find an up-to-date list of our servers on the right side of the setup modal.

  4. Enter the username and password in their respective fields.

  5. In the Database Name field, enter the name of your database.

  6. Verify that all required information is entered correctly.

    Example:

    Database Connection
    If properly filled, your form should look something like this.
  7. Click "Test Connection" to verify the connection.

  8. If the test is successful, proceed. Otherwise, check the error message and try again.

    Example:

    Database Connection Test
    In this example, only the SELECT permission is enabled for the user.

    WARNING

    Ensure the user has only the minimum required permissions for database access. Permissions marked with a green checkmark are required; any unnecessary ones should be removed.

  9. If using a supported framework, select it in the automapping field. This will automatically map the tables and columns.

    Example:

    Automapping
  10. Click "Next".

Map the Citizens' Table

  1. If using a supported framework, the citizens' table will be mapped automatically. You can skip to step 4; otherwise, you'll need to map the columns manually.

    Example:

    Citizen Mapping Example
    In this example, the citizens' table is mapped automatically with the QBCore framework.
  2. Select the table that contains your citizens' data.

  3. Map the columns to their corresponding fields.

    TIP

    • Hover over the question mark icon for explanations.
    • If a second dropdown appears, the column is formatted as JSON. You must select the nested property.
  4. Click "Test Connection" to verify.

  5. If successful, up to three citizens from your database will be displayed. Otherwise, check the error message and try again.

    Example:

    Citizen Connection Test
  6. Click "Next".

Map the Vehicles' Table

  1. If using a supported framework, the vehicles' table will be mapped automatically. You can skip to step 4; otherwise, you'll need to map the columns manually.

    Example:

    Vehicle Mapping Example
    In this example, the vehicles' table is mapped automatically with the QBCore framework.
  2. Select the table that contains your citizens' data.

  3. Map the columns to their corresponding fields.

    TIP

    • Hover over the question mark icon for explanations.
    • If a second dropdown appears, the column is formatted as JSON. You must select the nested property.
  4. Click "Test Connection" to verify.

  5. If successful, up to three citizens from your database will be displayed. Otherwise, check the error message and try again.

    Example:

    Vehicle Connection Test
  6. Click "Next".

Map the Licenses and Permits Table

  1. If using a supported framework, the licenses and permits table will be mapped automatically. Skip to step 5. Otherwise, map the columns manually.

    Example:

    License Mapping Example
    In this example, the licenses' table is mapped automatically with the QBCore framework.
  2. Select the type of link between citizens and licenses. If you're unsure, feel free to contact the support.

  3. Select the table containing the licenses' data. It can be a separate table or in some cases the same as your citizens' table.

  4. Map the columns accordingly.

    TIP

    • Hover over the question mark icon for explanations.
    • If a second dropdown appears, the column is formatted as JSON. Select the nested column.
  5. Click "Test Connection" to verify.

  6. If successful, up to three citizens with their licenses will be displayed. Otherwise, check the error message and try again.

    Example:

    License Connection Test
  7. Click "Next".

Configure License Name Mapping

This step maps license names from your database to those in the MDT (e.g., driverDriver's License).

  1. If using a supported framework, the mapping is created automatically. You may need to add additional mappings if you have extra licenses.

    Example:

    License Name Mapping Example
    In this example, the licenses names are added automatically based on the QBCore framework.
  2. To add a new license name, enter the database value and the display name for the MDT, then click "Add".

  3. Repeat the previous step for each additional license.

  4. Click "Next".

Review and Save the Setup

  1. Review your setup. To make changes, click on the step number at the top of the modal.

  2. Click "Save". You should see a success message.

    Example:

    Completed Config Example

Database Sync is Ready

Congratulations! You have successfully set up the database sync feature for your community. You can now view your citizen and vehicle data in real time inside the MDT.

For assistance, reach out to our support team. We're happy to help!