First of all it takes to be acquainted with PostgreSQL.
Connect to one of the dummy data base using the program 'psql' and create your own databases...I use 'test' for testing and 'LOG' for real  work. You can choose any name and any number of them. Create also users and give them
authorisations and passwords.
The tutorial of PostgreSQL and the manual and psql are to be studied
carefully.

Possibly you have to edit as "root" the file pg_hba.conf. For instance
in SuSE 11.1 it is in /var/lib/pgsql/data; or elsewhere depending on the distribution you
have (Debian has it in /etc/postgresql/8.3/main ).
 Change the line:

 local      all       all     ident sameuser

in

 local      all       all     trust

and cross fingers !

The next step is to create the users, give them the right authorization etc., 
then create the data bases (one or more: I use one for testing and the other for 
real use).


There are Three methods to build the data bases: The mode 'A' let you go into the details of every table, so is more didactic.
The mode 'B' is quicker but you will not practice with the various tables.
The mode 'C' is the simpler....


---Mode 'A' -----

The file qso.txt contains the commands to create the table 'qso'.
To populate the table qso, just for testing, you can load directly from DBLog the file ADIF ZP4KFX-2008.ADI

The file configs.txt contains the commands to create two tables:
'configs' which will be loaded with various configurations lines, and
'lastconf' which contains only the name of the last used configuration.

This configuration is loaded by default at start-up.

Edit both qso.txt and configs.txt so that paths agree with your setup.

Use the program 'psql' to load qso.txt and configs.txt.
Run: 'psql yourdatabasename'
Then at the psql prompt give the commands:

    			\i /put/here/your/path/qso.txt
			\i /put/here/your/path/configs.txt

The file ZP4KFX-2008.ADI contains my log in ADIF format; you can load it
with ADIF Import. Just use it for testing, then load your own datas.
Do the same with zp4kfxconf.db .


Two more tables are used to identify dxcc countries from the call:

- prefix , contains a list of known prefixes and the corresponding dxcc
           number which identifies the country.
- dxcct , for every dxcc number gives a set on information for that country: 
          itu zone, cq zone, continent, etc.
	
 The files prefix.txt and dxcc.txt create and fill those two tables
 using respectively pfx.db and dxcc.db.
 As seen before use psql to load both, with the command \i .

                        \i /put/here/your/path/prefix.txt
			\i /put/here/your/path/dxcc.txt

Of course you can edit them to adapt them to your needs.
Especially pfx.db and dxcc.db need a constant maintenance as new
prefixes appear.
NOTE: It takes to modify pfx.txt for prefixes: SV_A (Mt. Athos) as I do not know
      the '\A' meaning.
      The same applies to JD_M, JD_O, FO_M, FO_C, FO_A, 3G0_Y, 3Y_B, 3Y_P, 3Y_X
      and 3Y_E.

The files bands.txt and bands.db create and fill a small table with band edges.
It is used to alarm in case the radio is out of the amateur segments.

                   \i /put/here/your/path/bands.txt

will load it. Check if bands.txt agrees with your zone or country

Use		   \i /put/here/your/path/stat.txt

to generate the 'statistics' table which will be filled by Update Statistics and
any time a new qso is logged or an ADIF file is imported.

Starting from version 0.8.1 has been introduced the new table 'modes'.

As for others

                 \i /put/here/your/path/modes.txt    

after having edited the path in modes.txt
It loads the datas in modes.db. You can edit it to agree with your
band plan being responsible of not overlapping modes.

Starting from version 0.9.1 also the table 'radios' has been introduced, so:

		\i /put/here/your/path/radios.txt

It will load the radio numbers as defined by Hamlib.

Starting from version 0.9.7 has been added the table spots which stores
for one hour spots received from the cluster, heard stations and CQ frequency
for every band.
As usual:
                \i /put/here/your/path/spots.txt

Starting from version 0.11.1 has been added the table 'ncdxf' which holds
the name and state of the beacons of NCDXF system.

                \i /put/here/your/path/ncdxf.txt

Starting from version 1.3 has been added the table 'clusters' which holds the address and port number of various clusters

                \i /put/here/your/path/clusters.txt



The files countries.txt and countries.db are no more used.



---Mode 'B' -----

The file dblog_db.dmp contains a dump of an empty data-base.

Give the command:  

  createdb -T template0 -E UTF8  yourlog

where 'yourlog' is the name that you want to give to your log. You can do many of them.

Then give the command:

  psql yourlog < dblog_db.dmp


---Mode 'C' -----
 
Just copy into your home directory the template file dblog_db.dmp, then run dblog.
The first window will ask you the username, his password and the database name.
If that database does not exist dblog will ask you if you want create a new one...say YES.. that's it !


Then, using the config function of DBLog, you will change the configuration values: your call, radio etc.


