- Części Zamienne
22 maja 2013
In some projects, it is quite interesting to access to the CAC database for 3rd party apps integration purposes or just to check out the information stored in the database.
In this application note we are going to introduce some tools which may be useful to achieve this:
A database is an organized collection of data. In our case, the database is the group of data tables which include information about all Users, Doors, Profiles, etc. and all their corresponding univoque features such as door-number or User-ID.
In CAC, the database is stored in a file called “bdmds”
Database Management System: (DBMS)
A Database Management Systems (DBMS) is a set of programs that enables storing, modifying, and extracting information from a database. It also provides users with tools to add, delete, access, modify, and analyze data stored in one location. It is frequently called “Database Engine”.
Well known DBMSs include Oracle, FoxPro, Microsoft Access, Microsoft SQL Server, Paradox, MySQL, SQLite, etc. A database is not generally portable across different DBMS, but different DBMSs can inter-operate to some degree by using standards like SQL to support a single application built over more than one database.
In CAC, the Database Engine used is MySQL
CAC DB_Manager is just a software which will be useful to generate the corresponging permissions to access to the CAC Database. The software is available on the following link (Direct Download):
HOW TO USE
1.- Unzip the file to a known folder.
2.- Double click in
3.- The software will connect to the database
4.- If the software has been launched properly, the following form will be shown:
5.- Enter a valid user: from 3 to 15 alphabetic characters and click on “Create New User” and “Yes”
6.- A User-key (password) will be generated. Write it down and avoid that 3rd persons may note this key.
7.- The software will ask about creating another user. Select “Yes” to continue or “No” to exit.
NOTE: This password is different and univoque for each user. It is generated using an algorithm that includes the username and some features of the own PC. Therefore, this key will be different if we execute the software in different computers.
NOTE: In case we create another user with the same name, this will overwrite the previous one.
At this point, we have created a new user to manage the CAC database. In our case:
This user will have the following persimissions to manage the CAC Database using a MySQL Client:
This user will not be able to erase tables in order to respect the structure of the database, not getting the bdmds file corrupted by mistake.
Once a valid user has been created, we can connect to the database manually using a MySQL Client. In this article we will use HeidiSQL (Open Source) but you can use any other one
How to connect to the database:
First of all, we need to install a MySQL Client. On the following link, there is available a free one (HeidiSQL)
Once we have launched the SQL Client, we will open a communication with the MySQL Server. It is important that the server is running, so do not forget to execute CAC Database Server
Selecting a specific table in the “bdmds” list, there is a TAB in which we can see its internal data format:
Selecting a specific table in the “bdmds” list, there is a TAB in which we can see the information stored:
How to create a back-up manually:
Using a SQL Client, we can save a back-up of our installation.
In general, a backup file in CAC is just a list of SQL sentences executed in MySQL server which:
1.- In HeidiSQL right-click on “bdmds” and “Export database as SQL”
2.- Select a folder and name to save the Back-up. Set the options as per indicated in the following example:
3.- The file created will be saved as .sql file. We cannot import this file into CAC Server but we can use HeidiSQL afterwards to import this file (which contains SQL sentences with the information of the whole installation), overwritting the existing database.
To import this back-up to the database, just doble-click on this file and select the MySQL connection as we did above:
Finally, in HeidiSQL you can execute this sql file. The sentences will be executed overwriting the existing databae and creating a new one with the information we had saved on this back-up.
You can download the full application note on the following link:
For any further assistance, do not hesitate to contact FERMAX Technical department.