Monday, September 03, 2007

Sharing the database accorss Local Area Network

Open Contacts uses Firebird database server as database engine. By default, OC uses Firebird embedded which is installed implicitly. Open Contacts is very much self-contained.

If you prefer using OC in office environment where people using multiple copies of OC will share the same set of info of business contacts, a standalone Firebird database server should be installed.

Assuming that you have installed Open Contacts on computer "MyClient1" and are going to use computer "MyHost" to host the database and linked files, here are the steps:

1. Download and install Firebird database server.

1. Download Firebird for Windows

Firebird is an open source FREEWARE program that can run on Windows, Linux and Unix. Please visit

http://www.firebirdsql.org

for general info about Firebird. It is recommended that you use the latest production version of Firebird.

2. Install Firebird

Generally, the host machine is a server machine in your Local Area Network. For example, you may install Firebird on computer "MyHost".

During the installation, the installation program will ask you whether you want the database sever to run as a Windows service or Windows application. In general, you should make it run as a Windows service.

3. Copy "udfoc.dll" in computer MyClient1 to directory "udf" of the program directory of Firebird which is installed in computer MyHost.

And "udfoc.dll" comes with Open Contacts, it is located in directory "udf" of the program directory of Open Contacts. In the host computer MyHost, you should place "udfoc.dll" in directory "udf" of Firebird program directory.

4. Make sure that any firewall program or antivirus program on the host machine allow Firebird to listen to client requests.

2. Prepare database files on the server

Assuming the server machine is "MyHost".

1. Create a secured directory (for example "D:\SecuredData\OC") not accessible across the network but the Firebird database server only.

2. Move database file "Default.gdb" from MyClient1 to "D:\SecuredData\OC". Thus, no client computer should be able to access the database file directly through networking file sharing, but through Firebird database server only.

3. Create a working directory (for example "D:\WorkData\OCData") shareable by some users across the network according your local security policy, and move file "main.ini", directory "templates" and directory "files" to the working directory from MyClient1. Please make the files directory writable by these users. The working directory may be accessed through something like "\\myhost\SharedOCWorking" which points to D:\WorkData\OCData.

4. Modify main.ini to make the database settings point to the server machine as described below.

The INI file contains pointers to to the address book database, as shown in the example below.

[General]
User=SYSDBA
Password=masterkey
Protocol=firebird-2.0
Database=myhost:d:\secureddata\ocdata\default.GDB
DemoDatabase=myhost:d:\secureddata\ocdata\demo.gdb

The user name/password pair is used for authentication to the Firebird databases "default.GDB" and "demo.gdb". Both files are located in "d:\secureddata\ocdata\" of the host machine "myhost". Thus, Open Contacts knows it should connect to server "myhost" and talk to the Firebird database server there. Then the database will process the database file in the host machine's D drive and authenticate the user name/password pair.

Though file "main.ini" sits as a shareable file on computer "MyHost", the settings are used by Open Contacts running on computer "MyClient1". Thus the settings need to tell Open Contacts the host name "myhost".

5. Test. Create a program shortcut on computer "MyClient1" with the Target directory pointing to the program directory of Open Contacts, and the Start-in directory pointing to the working directory located in "\\myhost\SharedOCWorking" . Run Open Contacts via the shortcut.

3. Install Open Contacts on each of the workstations (client machines)

After positive result of the test, you may start clone the program and shortcut on every workstations.

  1. Run setup.exe.
  2. After finishing the installation, double click on shortcut "New Open Contacts Book".
  3. In the "Locate Working Directory" dialog, select "Locate working directory and create shortcuts".
  4. In the Folder Browser Dialog, select "\\myhost\SharedOCWorking".

Notes:

It is perfectly fine to install Open Contacts in a network share directory, so all client machines may use the same copy of Open Contacts program files. So you just then need to create shortcuts on each workstation.


A common error was to set the database path to a network path, for example
database=\\SomewhereInNetwork\MyDatabase.gdb
or
database=Z:\here\MyDAtabase.gdb
where Z is a mapped network drive. This won't work.