Using IBM Db2 with IBM FHIR Server
I spent a lot of time documenting the multi-tenancy schema and how the migration works in Db2.
Some of the critical links, the team updated, and I authored are:
- fhir-persistence-schema module readme
- Setup for IBM Db2 on Cloud
- The IBM FHIR Server – Db2 Multi-Tenancy
- The IBM FHIR Server – Db2 Schema Migration and Schema Management
- Schema: Db2 development
- Schema: Db2 Space Requirements
- Schema: Db2 SQL Tips
Interestingly, I spent the most time documenting the schema and how it supports the multi-tenancy with the following pattern:
Using ibm/db2 docker and using with IBM FHIR Server
Use the following Dockerfile
from this folder fhir-install/docker.
docker build -t fhirdb Dockerfile-db2 --squash
If you create the Db2 container without the above Dockerfile, please be sure to do the following:
- Add the trial license.
/opt/ibm/db2/V11.5/adm/db2licm -a /var/db2/db2trial.lic
- Update the Instance Memory Configuration
su - db2inst1 -c "db2 update dbm cfg using INSTANCE_MEMORY AUTOMATIC"
- Create the Db2 database with 32K pagesize
su - db2inst1 -c "db2 CREATE DB FHIRDB using codeset UTF-8 territory us PAGESIZE 32768"
- Add a Db2 user
groupadd -g 1002 fhir && \
useradd -u 1002 -g fhir -M -d /database/config/fhirserver fhirserver && \
echo "change-password" | passwd --stdin fhirserver
su - db2inst1 -c "db2 \"connect to fhirdb\" && db2 \"grant connect on database TO USER fhirserver\""
- Run the Schema creation with a small pool
–prop-file fhir-persistence-schema/db.properties
–schema-name FHIRDATA
–pool-size 2
–update-schema
- Create a new tenant
–prop-file fhir-persistence-schema/db.properties
–schema-name FHIRDATA
–allocate-tenant TNT1
- Contents of db.properties are
db.host=localhost
db.port=50000
db.database=fhirdb
user=db2inst1
password=change-me
sslConnection=false
Good luck with Docker/IBM FHIR Server
Leave a Reply