|
|
|
|
|
- Lesson 2 - Managing a Client/Server database
- Overview
- Configuring the computers
- Start the HFSQL Control Center
- Starting the HFSQL Control Center
- Creating a user account in the HFSQL Control Center
- Connecting to the HFSQL Client/Server database
- Creating a user
- Defining the rights of the new user
- To sum up
Tutorial - Using an HFSQL Client/Server database
Lesson 2 - Managing a Client/Server database We will cover the following topics: - The HFSQL Control Center.
- Creating a user in the HFSQL Control Center.
- Making a backup copy of the database.
 20 min Now that we know how to create and/or adapt an application to run in HFSQL Client/Server mode, let's see how to manage the associated database. A Client/Server database requires: - a specific configuration on the computers (install an HFSQL server, etc.).
- management via the HFSQL Control Center.
Configuring the computers To use an HFSQL Client/Server database, an HFSQL server must be installed on the server. Several HFSQL servers that use different ports can be installed on the same computer. For example, it is possible to install a test HFSQL server (with a test database) and a production HFSQL server on the same computer, using a different port. However, for performance reasons, this configuration is not recommended. One or more databases can be installed on each server. Start the HFSQL Control Center The HFSQL Control Center is used to fully manage HFSQL Client/Server databases and servers. We will present the most important features. First, we will open the HFSQL Control Center from the "WD Full Application" project that we used in the previous lesson.
Warning
All the actions from the previous lesson must have been completed to perform the actions on the "WD Full Application" project in this lesson.
Starting the HFSQL Control Center To open the HFSQL Control Center from WINDEV and access the data: - In the WINDEV menu, on the "Tools" tab, in the "Database" group, click "HFSQL". The HFSQL Control Center is displayed.
- The HFSQL Control Center home window appears. The analysis of the current project is automatically selected.
- Confirm. The HFSQL Control Center is displayed. This start mode allows you to see the different data files linked to the analysis of the current project.
- Click the vertical tab named "HFSQL C/S" if necessary. The list of HFSQL Client/Server data files appears.
The Control Center lists the Client/Server data files found in the analysis linked to the current project. No connection is established. The data files are grayed out.
- To view the records in the data files, double-click one of the data files in the list on the left (for example, "Order"). If the HFSQL Control Center does not recognize all the connection parameters, a window will allow you to establish the connection with the HFSQL Client/Server server used. If this window is displayed, specify the password and confirm.
- The information of the selected data file that uses this connection is displayed in a new "Order" tab. This information is available in several vertical tabs:
- The "Description" tab shows information about the data files (keys, items, etc.).
- The "Content" tab shows the records in the data files.
 The entire HFSQL Client/Server database can be managed from the HFSQL Control Center. Creating a user account in the HFSQL Control Center As explained before, an administrator account consisting of the "Admin" username and no password is created when the HFSQL server is installed. User accounts enable secure access to data. Not all the users of the application are administrators. Specific rights can be granted to each user (or group of users). Some users may not have rights to write to some data files, for example.
Warning
User rights defined in the HFSQL Control Center are database rights, not application rights. Client/Server database rights should not be confused with User Groupware rights.
To do a simple test, we will create a user and allow the user to see the records in the Customer data file. We are going to: - Connect to the database on the HFSQL server.
- Create a user.
- Grand different permissions to the user.
Connecting to the HFSQL Client/Server database To directly connect to the WD Full Application database located on the HFSQL server: - Expand the
menu at the top left of the HFSQL Control Center and select "Connect to an HFSQL server". - The HFSQL Control Center home window appears.
- The option "Connect to an HFSQL server" is selected by default. Specify the characteristics of the server that was installed in the previous lesson and validate.
- The characteristics of the HFSQL server are displayed.
Let's take a closer look at the information displayed: - the name of the HFSQL server and the list of databases are displayed in the left panel.
- in the right section, a new tab appears and shows the characteristics of the HFSQL server.
Creating a user To create a new user: - On the right section of the screen, select the "Users" tab. This tab is used to manage the users of the server.
Only the "Admin" user exists at this point.
- In the menu, in the "Users" group, click "New". The window used to define the user characteristics is displayed.
- Enter the following information:
(use "Test" as password for example).
 Several characteristics can be observed: - Superuser: Users defined as "Superusers" are allowed to perform all actions on the server, databases and data files.
- Account enabled: If this option is not checked, the user exists but he is not enabled (users on holiday for example).
- Password expiration: You can make a password valid only for a given number of days.
- Validate the user creation. By default, no rights are granted to this user.
Defining the rights of the new user We are now going to grant the user rights. The "Test" user can connect to the database and view the contents of the Customer data file. To grant rights to connect to the database: - In the HFSQL Control Center, double-click the "WD Full Application" database.
- On the "WD Full Application" tab, in the "Rights" group, click "Database rights".
- Select the "Test" user in the list of users.
- In the list of rights, for the action named "Rights to connect to the server (encrypted and unencrypted connection)", click in the "Defined rights" column and select the green checkmark.
- Click "Apply" at the bottom of the window. The rights become effective.
- Close the rights management window.
To grant rights to read the Customer data file: - In the HFSQL Control Center, expand the "WD Full Application" database and double-click the Customer data file (on the left of the screen).
- On the "Customer" tab, in the "Rights" group, click "File rights".
- Select the "Test" user in the list of users.
- In the list of rights, for the action named "Rights to read the records of a file", click in the "Defined rights" column and select the green checkmark.
- Click "Apply" at the bottom of the window. The rights become effective.
- Close the rights management window.
 Rights can be defined: - for the HFSQL server.
- for the database.
- for the database files.
Once the account has been created, it can be used when the application connects to the server using HOpenConnection. In our example, the "Test" user can only browse through the records in the Customer data file. If this user tries to perform another action, a message will be displayed: "The Test user has no sufficient rights to XXXX" (where XXXX corresponds to the action performed). We have seen the basics of the HFSQL Control Center. This database management program can also be used to: - stop or restart a server if a problem occurs,
- manage users and rights,
- reindex data files if necessary,
- create database backups.
The HFSQL Control Center is a redistributable tool that can be installed on the computers of users who are working with HFSQL Client/Server databases. The HFSQL Control Center must be used by the database administrator. Further information: - In this lesson, we explained how to manage users using the HFSQL Control Center. You can also manage users and their rights programmatically using specific WLanguage functions.
For more details, see HFSQL Client/Server functions. - To learn more about the HFSQL Control Center, see HFSQL Control Center: Overview.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|