PostgreSQL

Skip to end of metadata
Go to start of metadata

DCM4CHEE will work with PostgreSQL 8.x. You may download the database software from http://www.postgresql.org/

PostgreSQL 9.x
To use PostgreSQL 9.x - it is necessary to upgrade your Postgres driver in <DCM4CHEE_HOME>/server/default/lib to the 9.0 version:
  1. Download new from http://jdbc.postgresql.org/download.html - for example postgresql-9.0-801.jdbc4.jar.
  2. Delete the old one (postgresql-8.2-506.jdbc3.jar) and place there new jar file.

Very Basic Instructions

Setup PostgreSQL following instructions for your operating system.

Set permissions on Postgres database. The following setting will trust only connections from the localhost, which is reasonable for a development machine, but may need to be changed for production.

$PGDATA/pg_hba.conf:
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust

Initiate the archive database instance: pacsdb using create DDL script dcm4chee-psql-2.13.6/sql/create.psql

> export PGUSER=postgres
> createdb pacsdb
> psql pacsdb -f dcm4chee-psql-2.13.6/sql/create.psql

More Detailed Instructions (focused on Windows, but some is applicable to other operating systems)

  1. Install PostgreSQL using the installation wizard contained in the distribution.
  2. Accept the default Service User name of postgres, and install as a Windows Service.
  3. Name the database superuser postgres, with a password of your choice.
  4. When going through the Wizard, at the Initialize database cluster page, only select Accept connections on all addresses, not just localhost if this database server will be serving information over the network or if you intend on remotely accessing the database. If dcm4chee is installed and running on the same computer as the database, this checkbox should not be selected (i.e., the database will only accept connections from localhost).
  5. After installation, start the PostgreSQL service.
  6. Open pgAdmin (Start -> Programs -> PostgreSQL 8.2 -> pgAdmin III), and log in as the postgres user.
  7. Create a database called pacsdb (right click on Databases, and select New Database). Ensure the owner is the postgres user. Be sure to specify UTF8 encoding for the database.
  8. Ensure that the pacsdb database is selected/highlighted; select Tools, and then Query Tool from the top level menu within pgAdmin.
  9. Within the pgAdmin Query Tool, Click on File -> Open. Open the file /sql/create.psql within the dcm4chee installation directory. Highlight all of the SQL statements, and click on the Execute Query button ( ). This should execute without any errors.
  10. In your dcm4chee installation, use a text editor to edit server/default/deploy/pacs-postgres-ds.xml, and server/default/deploy/arr-psql-ds.xml. These files control the dcm4chee connections to the database. pacs-postgres-ds.xml is for the main archive application, and arr-psql-ds.xml is for the Audit Record Repository (ARR). Note that if you opted to install the ARR on a separate machine or as a separate process, this file will not be in your dcm4chee installation directory. Ensure the connection information, including the user name and password, are correct.
  11. It is now ready for dcm4chee to use it!

Advanced (optional) Instructions

Using a Different User as the Database Owner

Sometimes it is desirable to set up a specific user in postgres to handle the database interaction. This may be a situation where the database is shared by multiple applications, or you do not want to use the DB super user account within dcm4chee. In this case, you will need to create a new user in postgres. When creating the database ensure that the desired user is selected as the database owner (see step 7 above), and make the necessary changes in the datasource config files (see step 10 above).

Using a Different Directory (tablespace) for dcm4chee Data

Postgres will by default store all of the dcm4chee data in a subdirectory the postgres installation directory. This is the default tablespace. As you can imagine there are many scenarios where this is not desirable; you may have a specific mount point or file system that you want to store the database on. The two main use cases for this are:

  • You want to separate the database file system from the DICOM image file system for performance reasons. I.e. to eliminate disk IO contention between image file reads/writes, database file reads/writes, and/or application log file writes.
  • You have a separate disk or disk array that has a backup strategy in place, and/or is managed in an HA or fault tolerant manner.

In this case, before you create the database (in step 7 above), create a tablespace.

  1. Create a directory on the desired file system to hold the dcm4chee data files.
    File System Permissions
    Ensure that the postgres Service User has full control of the created directory, with regards to Windows (or other operating system) Security/Permissions for the folder.
  2. Right click on Tablespaces
  3. Select New Tablespace for the database.
  4. The tablespace location should be the directory you just created, and the owner should be postgres (or other user if you're using a non-default user id for dcm4chee database access). Name the tablespace dcm4chee.
  5. Specify this tablespace when you create the dcm4chee database (see step 7 above).

Securing the Database Password on the File System

See How to configure secure DB password

Tuning

Your mileage may vary on this, as every installation is different. I have had success with these parameters in some installations. Again, keep in mind that tuning is very specific to the usage of the archive.

The following table lists some modifications that may be made to the default Postgres settings.

VERSION: 8.3.1

Property Default
dcm4chee
autovacuum on
on
max_connections 100 100
shared_buffers 32MB 512MB
temp_buffers 8MB 32MB
work_mem
1MB
4MB
maintenance_work_mem 16MB
64MB
wal_buffers 64kB 256kB
checkpoint_segments 3 10
effective_cache_size
128MB 512MB
port
5432
5432

Related Content:

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.