Setting up YajHFC for small work groups

This guide shows how you can set up YajHFC for small work groups. This means that the read/unread state is shared between different computers by storing that information in a database table on a server. Additionally the database server is used to create a shared phone book.

In this guide PostgreSQL (version 8.1) is used as database server.
YajHFC also supports other SQL compliant database servers like MySQL or Apache Derby. It is absolutely no problem to use a different database server (YajHFC only uses basic SQL), but of course the set up of the database server and the JDBC settings for YajHFC will be different from this guide. See below for the structure of the necessary database tables.

A. Setting up the database server

The commands in this section were tested on Debian/Ubuntu. They should be similar on other distributions, however.

  1. Install PostgreSQL: If not already done, the first step is to install PostgreSQL.
    If you use Debian or Ubuntu you can do this by entering the command aptitude install postgresql.
  2. Configure PostgreSQL:

    In the next step PostgreSQL has to be configured so that the databases can be accessed over the network using username and password.

    To do so, you'll have to edit the files pg_hba.conf and postgresql.conf. You can find them in the directory /etc/postgresql/<version>/main if you use Debian/Ubuntu, or in /var/lib/pgsql/data for OpenSUSE. On other distributions these files might be in a different place.

    Make sure that the pg_hba.conf contains the following line (usually you will have to add it):

     host    all     all     192.168.X.0/24                 md5

    192.168.X.0/24 has to be replaced by the adresses of your local network in CIDR notation.
    That means: If you use IP adresses of the form 192.168.115.X in your network, you will have to enter here.

    In the postgresql.conf you have to enable listening on the external network interface (of your local network). To do so, add the following line to the file:

     listen_addresses = '*'

    To complete this step you must restart the database server so that the modified configuration takes effect:

     /etc/init.d/postgresql restart
  3. Creating the database:

    First change your user identity to the administrative user of the PostgreSQL system:

     su postgres

    Then create a database for YajHFC:

     createdb yajhfc 

    Finally use this script to create the necessary database tables and users. As a default the script creates one user named "fax" with password "fax". If you want additional users or a different password (recommended), please edit the script before performing the next command.
    To create the tables, copy the createdb.sql script on the server and type the following command (as user postgres):

     psql yajhfc -f createdb.sql 

B. Setting up YajHFC

  1. Download the PostgreSQL JDBC driver: (If you are unsure use the JDBC3 driver.)

  2. Start YajHFC, open the Options dialog, add the newly downloaded JAR file as JDBC driver (Options->Plugins & JDBC->Add JDBC driver) and click OK.

    JDBC & Plugins panel
  3. Open the Options dialog again, set the save location under Server->Read/Unread state of faxes to "Database table" and click "Configure...".

    Server panel
  4. Enter the following settings in the appearing configuration dialog:

    Configuration dialog

    In the database URL you have to replace hylafax-test with the database server's host name.
    Example: If the database server is called server the correct URL is: jdbc:postgresql://server/yajhfc

    The other settings shown above can be used without modification (if you set up the database server according to this guide).

    Remark: "Test connection" should be successful here.

  5. Close all dialogs by clicking "OK".
  6. Open the phone book and click the menu item Phone book->Add to list->JDBC phone book. Enter the following settings in the appearing configuration dialog and click OK:

    Configuration dialog

    You will have to modify the database URL in the same way as above here (use the same URL in both cases).

    Remark: "Test connection" should be successful here, too.

  7. Done!

Necessary table structure

If you wish to create the database tables manually, the necessary database tables and fields are:

Table to save the read/unread state:

Field Data type
Fax file name         Text (variable length character data), should have space for 20 characters (i.e. VARCHAR(20)). This field should be the table's primary key.
Read/Unread state Logical/Boolean value (can be either true or false)
Comment Text (variable length character data), e.g. VARCHAR(200)
Last Modified Timestamp (Date+Time)

Table for the phonebook:

One database field for every phonebook field. Data type for all fields is text (variable length character data); should be sufficiently long (at least 30-40 characters; for example VARCHAR(40)).
For the comments field, using arbitrary length text is recommended (i.e. a TEXT/MEMO field).

Created by: Jonas Wolz

Last modification: Thursday, 27-Aug-2020 18:03:45 CEST