Using PostgreSQL as a database server in O&K Print Watch.

Since version 4.16.0.5037 O&K Print Watch supports the use of PostgreSQL as a database.

Required components:

  1. The print server or PC where the O&K Print Watch Service is to be used must have PostgreSQL ODBC driver 32 bit - https://ftp.postgresql.org/pub/odbc/versions/msi/psqlodbc_13_02_0000-x86.zip

  2. PostgreSQL installed. Remote connections to this server must be allowed.

  3. Creating a database script – postgresql.sql

Creating a user:

  1. Using pgAdmin or command prompt. Run createuser as superuser 'postgres', a new user must be created with a password. For example:
    createuser -U postgres --interactive --pwprompt

  2. Supeuser rights, rights to create a database and to create a new role are not required.

  • If you are adding a user to an existing database, you need to grant rights for the new user. For example:

    grant all privileges on database PRNWATCH_DB to prnwatch_user;
    alter default privileges for role postgres grant all on tables to prnwatch_user;
  • These actions are not required when creating a new database.

Creating a database:

    1. Run psql as superuser 'postgres':
      psql -U postgres

    2. Create a new database:
      Create database PRNWATCH_DB with owner = prnwatch_user;

    3. End the superuser session and log in as the created user:
      psql -d PRNWATCH_DB -U prnwatch_user

    4. Run the database script:
       \i с:/path_to_script/postgresql.sql;

    Set up the connection:

  • On the print server with O&K Print Watch, run the registry editor.

  • In the registry key HKEY_LOCAL_MACHINE\SOFTWARE\O&K Software\O&K Print Watch (for x64 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\O&K Software\O&K Print Watch) create ConnectionString value with type REG_SZ

  • Provider=MSDASQL;Driver={PostgreSQL ODBC Driver(UNICODE)};Server=localhost;Port=5432;Database=PRNWATCH_DB;UID=prnwatch_user;PWD=prnwatch_pwd

  • Server – name or IP address of the PostgreSQL server.

  • Port – PostgreSQL port number.

  • Database – name of the database created.

  • UID – name of the created user.

  • PWD – password of the created user.

Restart the O&K Print Watch Service if it has already been installed. Or start installation and select "Use current O&K Print Watch database settings".:

Linux
  • In /etc/printwatch/printwatch.conf change the variable ConnectionString to
    host=HOSTNAME_POSTGRESQL port=5432 dbname=PRNWATCH_DB user=prnwatch_user password=prnwatch_password

  • Change the variable Provider to
    PostgreSQL
  • Restart service
    systemctl restart printwatch

Using PostgreSQL and pgBouncer with a large number of clients