Access The MiaRec Database Via ODBC Driver
Please note: this is legacy documentation. Please check out https://docs.miarec.com/all/ for the most up-to-date documentation and user guides.
MiaRec uses PostgreSQL as the database engine. This article describes how to connect to the PostgreSQL database via the ODBC driver. First of all, download the ODBC driver and install on the same computer, where your application is running.
Here you will find a sample source code on C# for accessing the PostgreSQL database:
Please, note, the MiaRec database (PostgreSQL) is listening on port 6082 (by default, but this may be changed during the installation of MiaRec).
Database name: miarec
Database user: miarec
If you are running your application on a different computer than MiaRec is running on, then you need to do additional changes inside the MiaRec configuration. By default, only local applications can access MiaRec Database. Access to the database via a network is forbidden.
In order to access MiaRec Database (PostgreSQL) from another computer (non-localhost), you need to make two things:
- Edit file pg_hba.conf (located in C:\Program Files\MiaRec Business\Data\DB)
- Edit file postgresql.conf
In the first file, you need to add the IP address of another computer, from which you need to access the database.
host all all 192.168.0.5/32 trust
Of course, you can allow access to whole your network, like:
host all all 192.168.0.0/24 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 a 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 the ODBC driver is also 32-bit. So, you need to open the 32-bit version of "ODBC Administrator".
Inside "ODBC Data Source Administrator" select the tab "User DSN" and click on the button "Add.." (see below screenshot).
Find in the list "PostgreSQL Unicode", select it and click on the "Finish" button (see below screenshot).
You will see a new dialog, where you will need to enter the settings of your ODBC connection (see the below screenshot).
"Data Source" is the name of this connection. You can type here any value, for example, "MiaRecDatabase".
"Database" should have the value "miarec" (without quotes).
"Server" is IP address of the server, where MiaRec is running, for example, 192.168.0.10 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 the installation of MiaRec).
"Password" is "password" (without quotes).
You can click on the "Test" button to check if the connection of the database is working.
Then click on the "Save" button.
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 the ‘calls’ table. In this table MiaRec stores information about every recorded call.
Audio files themselves are stored on a disk rather than inside a database. The database contains only a path to that file (for example, C:\Program Files\MiaRec Business\Data\Recordings\20090127\20090127100507.mp3).