PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
New WINDEV 28 feature!
  • In this lesson you will learn the following concepts
  • Overview
  • Configuring the computers
  • The HFSQL Control Center
  • Creating a user account in the HFSQL Control Center
  • Making a backup copy of the database
  • Conclusion
Lesson 5.3. Managing a Client/Server database
In this lesson you will learn the following concepts
  • The HFSQL Control Center.
  • Creating a user in the HFSQL Control Center.
  • Making a backup copy of the database.
Lesson duration

Estimated time: 20 mn
Previous LessonTable of contentsNext Lesson
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. One or more databases can be installed on each server.
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.
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 start the HFSQL Control Center from the "WD Full Application" project that we used in the previous lesson.
  • Open the project you worked on in the previous lesson.
    1. Go to the WINDEV home page (Ctrl + <).
    2. On the home page, click "Tutorial", then in "Part 5 - Manage an HFSQL Client/Server database", double-click "Full application (Exercise)".
    3. A dialogue box prompts you to open the project you worked on in the previous lesson. You can open the local copy or the original project. Select "Open the local copy".

Note

All the actions from the previous lesson must have been completed to perform the actions on the "WD Full Application" project in this lesson.


  • To start the HFSQL Control Center 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 screen. The HFSQL Control Center is displayed. This mode allows you to see the different 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 see the data in the files, double-click one of the data files in the list on the left ("Order" for example). 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
A single user account is created when installing an HFSQL server and creating a database: 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).

Caution!

The user rights specified in the HFSQL Control Center are granted for the database (not for the application).
Do not confuse the management of rights for the Client/Server databases with the User Groupware.
Some users may not have rights to write to some data files, for example.
To do a simple test, we will create a user and allow the user to see the records in the Customer data file.
  • To directly connect to the database on the 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:
      • the name of the HFSQL server and the list of databases are displayed in the left panel.
      • in the right section of the screen, a new tab appears and shows the characteristics of the HFSQL server.
        HFSQL Server characteristics
    5. On the right section of the screen, select the "Users" tab. This tab is used to manage the server users.
    6. Only the "Admin" user exists at this point.
      User management
    7. To create a new user, in the ribbon, in the "Users" group, click "New". The window used to define the user characteristics is displayed.
    8. Enter the following information:
      User properties
      (use "Test" as password for example).

      Note

      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).
    9. Validate the user creation. By default, no rights are granted to this user.
We will grant rights to the user: the "Test" user can 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.
Similarly, rights can be defined:
  • on the HFSQL server
  • on the database
  • on the database files.
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).
Once the account is created, it can be used when the application connects to the server (when HOpenConnection is used).

Note

The users and their rights can also be managed through programming with the WLanguage functions.
For more details, see HFSQL Client/Server management functions.
Making a backup copy of the database
To make a backup copy of the database:
  1. Go to the tab corresponding to the "WD Full Application" database.
  2. Select the "Backups" tab on the left.
  3. In the menu, in the "Backups" group, expand "New backup" and select "New hot backup".
    Remark: This option is available in the "Backups" group:
    • on the tab corresponding to the HFSQL server,
    • on the tab corresponding to the database.
      Remark: The wizard also allows you to make a backup of a selection of data files.
  4. Validate the backup.
Conclusion
The HFSQL Control Center is a complete database management tool that allows you 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.
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 28
Comments
Click [Add] to post a comment