ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV 2024 feature!
Help / WINDEV Tutorial / Tutorial - Using an HFSQL Client/Server database
  • 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.
Durée de la leçon 20 mn
Overview
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:
  1. In the WINDEV menu, on the "Tools" tab, in the "Database" group, click "HFSQL". The HFSQL Control Center is displayed.
  2. The HFSQL Control Center home window appears. The analysis of the current project is automatically selected.
    Home window
  3. Validate. 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.
  4. Click the vertical tab named "HFSQL C/S" if necessary. The list of HFSQL Client/Server data files appears.
    List of data files
    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.
  5. 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 validate.
  6. 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:
    Data file information
    • 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, when the HFSQL server is installed, a single user account is created: the administrator account ("Admin" username without password).
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
The user rights specified in the HFSQL Control Center are granted for the database (not for the application): The management of rights of Client/Server databases should not be confused with the User Groupware.
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:
  1. Expand the Control Center menu menu at the top left of the HFSQL Control Center and select "Connect to an HFSQL server".
  2. The HFSQL Control Center home window appears.
    Home window
  3. 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.
  4. 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.
    HFSQL Server characteristics

Creating a user

To create a new user:
  1. 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.
    User management
  2. In the menu, in the "Users" group, click "New". The window used to define the user characteristics is displayed.
  3. Enter the following information:
    User properties
    (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 is created but is not enabled (users on leave, for example).
    • Password expiration: You can specify a password valid only for a given number of days (configurable).
  4. Validate the user creation. By default, no rights are granted to this user.

Defining the rights of the new user

We will grant rights to the user: the "Test" user should be able to connect to the database and read the Customer data file.
To grant rights to connect to the database:
  1. In the HFSQL Control Center, double-click the "WD Full Application" database.
  2. On the "WD Full Application" tab, in the "Rights" group, click "Manage rights".
  3. Select the "Test" user in the list of users.
  4. 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.
    Rights of a user on the database
  5. Click "Apply" at the bottom of the window. The rights become effective.
  6. Close the rights management window.
To grant rights to read the Customer data file:
  1. In the HFSQL Control Center, expand the "WD Full Application" database and double-click the Customer data file (on the left of the screen).
  2. On the "Customer" tab, in the "Rights" group, click "Manage rights".
  3. Select the "Test" user in the list of users.
  4. 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.
    Rights of a user on a data file
  5. Click "Apply" at the bottom of the window. The rights become effective.
  6. 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).
To sum up
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:
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 2024
Comments
Click [Add] to post a comment

Last update: 12/04/2023

Send a report | Local help