Configuring Connections to Database
Configuring Connections to the DBMS
Ribbon: Point Clouds > Database > Configuring Connections to Database…
Menu: Point Clouds > Database > Configuring Connections to Database…
Toolbar: Point Clouds 3DScan >
Command line: NPC_DB_CONFIG
The command allows you to configure connections to existing PostgresSQL DBMS in order to create point cloud storages based on them. The main tool is the connection list bar:
The toolkit allows you to:
· Create new connections;
· Edit saved connections;
· Delete saved connections.
Creating new connections
A new connection can be created by two scenarios, depending on the state of the storage in DBMS:
1. The DBMS does not contain the database we need, or it is empty and does not contain any data or structure. In this case, the connection must be registered on behalf of a DBMS user with administrative rights. You can specify the name of a non-existent database. The command script will determine that there is no such database and will offer to create it. Next, on the created or connected database, the SQL script will be launched to create the necessary structure and necessary user groups. Further, the user specified in the connection will be added to the created group of users of the point cloud storage and the process of creating the connection will be completed by checking the correctness of everything created.
2. The DBMS has a database created by other users, a storage based on it, with a customized structure, user groups, rights. In this case, you can create a connection on behalf of a common DBMS user, but he should be included in the previously created point cloud storage user group.
When a connection is created, it checks whether it is possible to work with this connection. If the connection is not working, then the user will be prompted to either refuse to create it, or save it in order to correct some of its parameters in the future.
Checking connection status
To optimize the work with the bar, the first launch of the bar does not automatically check the status of connections, otherwise the monitoring timeout may be long. Instead, the user has a mechanism for updating the status of connections: selected in the list , or all available in the list .
The following information is available for each connection:
Status |
1. “The DB is available and has the correct structure”
2. “The DB is available and has the incorrect structure” Such situation occurs when the major version of the DBMS structure is lower than the major version of nanoCAD storage functions structure. In this situation, the Reset button will be available.
3. “The user does not have access rights to the DB” Such situation occurs when connecting to an existing database, if the DBMS user connecting is not included in the point cloud storage users group. To eliminate it, contact the DBMS administrator, who must enter the user into the user group of this point cloud storage.
4. “The DB is not available” Such situation occurs if for some reason this connection could not be established. You need to check your connection details. And contact the DBMS administrator. |
Connection |
The connection name cannot be edited. To change the connection name, you need to recreate the connection. |
Size |
The size of the data in the database. |
Version |
The database structure version consists of a major version and a minor one. The major one describes the data structure, the minor one describes the set of functions and stored procedures. Changing the major version (in the new nanoCAD version) requires re-creation of the storage and can only be performed by the user’s explicit choice through the Reset button, and all data in the storage will be lost. Changes to the minor version of the structure can be made invisible to the user by automatic update. It does not threaten the integrity of the data in the storage. Automatic updates are checked and performed when the connection statuses are updated in the connection list bar. |
In addition, two actions are available depending on the connection status:
· Clearing the existing DB
· Updating the structure of an existing DB
Alternative DB Configuration
The connection list bar allows you to create a database and fully configure it for use as a storage for point clouds. If desired, you can configure the database through the PostgreSQL DBMS administrative tools. DB creation script:
CREATE DATABASE “Name” WITH OWNER = recs_admin TEMPLATE = ''template0'' ENCODING = ''SQL_ASCII'' TABLESPACE = pg_default LC_COLLATE = ''C'' LC_CTYPE = ''C'' CONNECTION LIMIT = -1;
It is also necessary to preliminary create the recs_user user group and the recs_admin superuser included in it, on behalf of which the database should be created. When creating a database, these groups need to set the rights to work with the created DBMS:
CREATE ROLE recs_user WITH LOGIN INHERIT CREATEROLE PASSWORD “Password”;
CREATE ROLE recs_admin WITH LOGIN SUPERUSER INHERIT CREATEROLE CREATEDB PASSWORD “Password”;
GRANT recs_user TO recs_admin;
SET ROLE recs_admin;
GRANT USAGE ON SCHEMA public TO recs_user;
GRANT ALL ON ALL TABLES IN SCHEMA public TO recs_user;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO recs_user;
GRANT ALL ON ALL FUNCTIONS IN SCHEMA public TO recs_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO recs_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO recs_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO recs_user;
Connection settings are saved in a protected .Default.dbcfg file.