Access MiaRec DB via ODBC driver

MiaRec uses PostgreSQL as database engine. This article describes how to connect to PostgreSQL database via ODBC driver.

First of all, download ODBC driver and install in the same computer, where your application is running.

Here you will find a sample source code on C#  for accessing PostgreSQL database:

Please, note, MiaRec database (PostgreSQL) is listening on port 6082 (by default, but this may be changed during installation of MiaRec).
Database name: miarec
Database user: miarec
Password: password

If you are running your application on different computer than MiaRec is running on, then you need to do additional changes inside MiaRec configuration.
By default, only local applications can access MiaRec Database. Access to database via network is forbidden.

In order to access MiaRec Database (PostgreSQL) from another computer (non-localhost), you need to make two things:

  1. Edit file pg_hba.conf (located in C:\Program Files\MiaRec Business\Data\DB)
  2. Edit file postgresql.conf

In the first file you need to add ip-address of another computer, from where you do access of database.
For example:

host    all         all          trust

Of course, you can allow access to whole your network, like:

host    all         all          trust

In the second file you need to find following string:

#listen_addresses = 'localhost'               # what IP address(es) to listen on;

By default it is commented (see hash symbol #).
You need to uncomment it and change ‘localhost’ to ‘*’, like:

listen_addresses = '*'                # what IP address(es) to listen on;

Save the file and restart “MiaRec DB” service.

After that you will be able to access database from other computers.

Now you need to configure ODBC Data Source on your computer.

Open "ODBC Data Source Administrator" in Control Panel->Administration.

Note for 64-bit systems:

If you are running 64-bit operating system, then you need to start "ODBC Data Source Administrator" manually from here: C:\Windows\SysWOW64\odbcad32.exe

PostgreSQL itself is 32-bit and ODBC driver is also 32-bit. So, you need to open 32-bit version of "ODBC Administrator".

Inside "ODBC Data Source Administrator" select tab "User DSN" and click on button "Add.." (see below screenshot).


Find in the list "PostgreSQL Unicode", select it and click on "Finish" button (see below screenshot).

ODBC New Data Source

You will see new dialog, where you will need to enter settings of your ODBC connection (see below screenshot).

"Data Source" is a name of this connection. You can type here any value, for example, "MiaRecDatabase".

"Database" should have value "miarec" (without quotes).

"Server" is ip-address of the server, where MiaRec is running, for example, or "localhost", if you start Excel and MiaRec on the same machine.

"User Name" is "miarec" (without quotes).

"Port" is 6082 (this is a default port. It may be changed during installation of MiaRec).

"Password" is "password" (without quotes).

You can click on "Test" button to check, if connection of database is working.
Then click on "Save" button.

PostgreSQL ODBC Driver Setup

Now you can use this ODBC connection for accessing MiaRec Database from your application.

There are many tables inside MiaRec Database. But for you only one table is a point of interest. It is ‘calls’ table. In this table MiaRec stores information about every recorded call.

Audio files themselves are stored on disk rather than inside database. The database contains only a path to that file (for example, C:\Program Files\MiaRec Business\Data\Recordings\20090127\20090127100507.mp3).