Connecting to various databases

Introduction

This page lists details on how to connect to various databases in Bahmni.

Bahmni comprises of different sub-components, like OpenMRS, OpenELIS, OpenERP/Odoo, Dcm4chee, PACS-Integration service, etc. Each component talks to its own database, which may be created within MySQL or Postgres. To see the contents of a particular database, you will need to use the right command line tool for MySQL or Postgres, and also appropriate credentials. 

MySQL Database Server

For MySQL Databases, the mysql command is used to connect to mysql databases, and view tables and data. Please refer to this resource to see all the commonly used MySQL Commands: MySQL Cheatsheet 

Note: If you are connecting to MySQL running inside a Vagrant Box (or a VM) from your host machine, you will need to connect to IP: 192.168.33.10 and port: 3306.

PostgreSQL Databases

For PostgreSQL Databases, the psql command is used to connect to PostgreSQL databases, and view tables and data. Please refer to this resource to see all the commonly used commands: PostgreSQL DB Administration Commands. If you want to use a graphical GUI tool for psql, then you can try out PgAdmin.

To connect to PostgreSQL DB as admin, and alter databases, or drop them use the command: "psql -Upostgres".

Note: If you are connecting to PostgreSQL running inside a Vagrant Box (or a VM), you may need to refer to this for ensuring the proper ports are open, in case you aren't able to connect from host machine: http://stackoverflow.com/questions/14139017/cannot-connect-to-postgres-running-on-vm-from-host-machine-using-md5-method



SSH Tunnel for Postgres / MySql DB

You can also try using the SSH Tunnelling connection options for connecting to databases. More details here. Sample screenshot here: http://pasteboard.co/rUg67MP.jpg


List of Application Databases


The connection credentials shown here are the default. These may have been modified during installation by the Administrator.


ApplicationDB Server TypeDatabase NameConnection Command
1.OpenMRS (EMR)MySQLopenmrs
> mysql -uopenmrs-user -ppassword openmrs

# For Bahmni 0.92
> mysql -uroot -pP@ssw0rd openmrs
2.OpenELIS (Lab)PostgreSQLclinlims
> psql -Uclinlims clinlims
3.OpenERP/OdooPostgreSQLopenerp/odoo
> psql -Uopenerp openerp
OR
> psql -Uodoo odoo
4.dcm4cheePostgreSQLpacsdb
> psql -Upostgres pacsdb
5.PACS Integration ServicePostgreSQLbahmni_pacs
> psql -Upostgres bahmni_pacs
6.Crater (Bahmni LITE)MySQLcrater
# connect to crater db
> mysql -ucrater -pcrater crater
# connect to crater atomfeed db
> mysql -ucrater_atomfeed_user  -ppassw0rd crater_atomfeed





Related Reading: Debugging performance issues in MySQL / Postgres DB: Troubleshooting performance issues in SQL, OpenERP and OpenELIS

The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)