Set up DB Sync in direct mode

The DB Sync framework can work in direct mode, without using the GAS and GIP.

The following steps allow you to execute the [dbsync_server] as a standalone program. This allows the DB Sync client apps to connect in direct mode, for testing purposes or when the GAS/SSO mode and load balancing is not required.

  1. Set up the environment:

    • Go to the DB Sync installation directory and run the DB client envdbsync script (envdbsync.bat on Windows)
  2. Make sure the GDC front-end is started, to display configuration and DB Sync client app forms.

  3. Extract the DB Sync database schema file (JSON) with the dbsync_schema extract tool, from an existing database:
    dbsync_schema extract -d mydb -r dbmpgs_9 ... -f library_schema.json
  4. Define the server-side configuration file (JSON format) and save this file in a directory of your choice. In this section, we will use the server configuration filename $DBSYNCDIR/conf/myconfig_library.json.

    For example, with a PostgreSQL database server:
    {
        "schema_file": "library_schema.json",
        "dbconn": {
            "dbname": "library",
            "owner": "public",
            "source": "library@localhost:5432",
            "driver": "dbmpgs",
            "uname": "pgsuser",
            "upswd": "xxxxxxx"
        }
    }
  5. Use the dbsync_schema edit tool to complete the DB Sync schema with application SQL table that must be synchronized. Specify information such as auto-generated columns and table relations:
    dbsync_schema edit -c $DBSYNCDIR/conf/myconfig_library.json
    Tip:
    Make sure that the schema filename defined in the server configuration file can be reached from the directory where you execute the dbsync_schema tool, especially when using a relative path like this:
      "schema_file": "./mystore.json"
  6. Create the DB Sync system tables with the dbsync_setup tool:
    dbsync_setup create-tables -c $DBSYNCDIR/conf/myconfig_library.json

    For more details, see DB Sync system tables.

  7. Define the client-side config file (JSON format) - this client configuration file must be bundled and distributed with your app program files.

    For the direct mode, the use_gas parameter must be set to false:
    {
        "app_id": "app_library",
        "protocol": "http",
        "authority": {
            "host": "localhost",
            "port": 6394
        },
        "service_name": "dbsync_server",
        "use_gas": false
    }
  8. DB Sync client apps must be defined with the dbsync_app_conf program:
    dbsync_app_conf -c $DBSYNCDIR/conf/myconfig_library.json
    The main task here is to define the app name, description, and associate the SQL tables used by the app. For more details, see Apps definition console.
  9. The DB Sync users need to be created directly with the dbsync_user_conf program, with the -x argument to be able to create/delete users.
    dbsync_user_conf -x -c $DBSYNCDIR/conf/myconfig_library.json

    Users and can be defined with a password.

    For more details on user definitions, see Users definition console.
  10. The data filter parameters can be defined for each end user in the dbsync_user_conf configuration tool.

  11. Open a dedicated terminal, set the DB Sync environment and start the DB Sync server program in direct mode with the following command:
    dbsync_server -c $DBSYNCDIR/conf/myconfig_library.json -p 6394 -v

    Read the dbsync_server command reference page for more details.