- In this lesson you will learn the following concepts
- Overview
- Installing a local HFSQL server
- Creating an application that uses an HFSQL Client/Server database
- Adapting an application to use an HFSQL Client/Server database
- Overview
- Adapting the example
- Features available in HFSQL Client/Server mode
Lesson 5.2. Implementing a Client/Server database In this lesson you will learn the following concepts - Installing a local HFSQL server.
- Creating an application that uses an HFSQL Client/Server database.
- Adapting an application to support an HFSQL Client/Server database.
- Features available in Client/Server mode.
In this lesson, we are going to perform all operations required to develop and deploy an application that uses an HFSQL Client/Server database. Installing a local HFSQL server The first operation to perform consists in installing an HFSQL server. This server can be installed locally on the development computer (that's what we are going to do). On the deployment side, the server can be installed on a specific computer. The HFSQL server setup program is included in the WINDEV, WEBDEV and WINDEV Mobile setup media. If you do not have this media, the HFSQL server setup is also available on our site ( www.windev.com). To install the HFSQL server locally: - Start the WINDEV/WEBDEV/WINDEV Mobile setup program.
- Select "Install HFSQL Client/Server".
- Then, select "Install or update an HFSQL server".
- Accept the license agreement.
- Select a platform ("For Windows on this computer").
- If there are HFSQL servers already installed on the current computer, select "Install a new server".
- Select the setup directory and specify the server name and port. The port 4900 will be used by default.
| | |  | Note | Don't forget to open this port on the firewall in order to connect to the HFSQL server from another computer. |
- Specify the login credentials of the user with administrator privileges that will be created by default on the HFSQL server. By default, this user is "Admin" and has no password.
| | |  | Note | For security reasons, don't forget to change the administrator password. |
- Install the HFSQL Control Center if it is not already installed or cannot be accessed from your computer.
| | |  | Caution! | The HFSQL Control Center is required to manage the HFSQL Client/Server database. |
- The wizard prompts you to configure the sending of notifications to identify server problems in real time. In this case, go to the next step and indicate that the settings will be defined "Later".
- The wizard allows you to enable the Active Directory authentication. Enable this option if necessary.
- You can help us improve by allowing us to collect information regarding the use of our products. This optional and anonymous data collection allows PC SOFT to improve its products.
- The setup is completed. By default (if you have not changed the administrator settings), to connect to the server in administrator mode, you must use the "Admin" user without password.
Creating an application that uses an HFSQL Client/Server database Creating a WINDEV application that uses an HFSQL Client/Server database is very simple. You must: - Create the project with a new database.
- Create the analysis by specifying that the databases used by the project will be "HFSQL Client/Server" databases.
- Specify the characteristics of the connection to the HFSQL Client/Server server that will be used.
- When creating a data file in the analysis, indicate that this data file is in Client/Server mode and specify the connection used.
| | |  | Note | You can also define the connection to the HFSQL server programmatically. For more details, see the online help: HDescribeConnection. |
Adapting an application to use an HFSQL Client/Server database Overview Switching an HFSQL Classic database to Client/Server is the most common operation. WINDEV offers different methods to switch the database: - from the data model editor.
- from the HFSQL Control Center.
To better understand how to change the type of database, we are going to switch the application created in Part 4 to Client/Server mode using the data model editor. Adapting the example We will adapt the "WD Full Application" project (created in part 4 of this tutorial) to use an HFSQL Client/Server database.
- Open the project you worked on in the previous lesson.
- Go to the WINDEV home page (Ctrl + <).
- On the home page, click "Tutorial", then in "Part 5 - Manage an HFSQL Client/Server database", double-click "Full application (Exercise)".
- 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".
| | |  | Answers | A corrected project is available. This project allows you to perform the different operations in this lesson. To open the corrected project, go to the home page and click "Tutorial", then in "Part 5 - Manage an HFSQL Client/Server database", double-click "Full application (Answers)". |
- To adapt the project:
- In the "Project explorer" pane, select the "Windows 32-bit executable" configuration.
- Load the analysis of your project in the data model editor: click
in the quick access buttons. The data model editor is displayed. - On the "Analysis" tab, in the "Connection" group, click "New connection". A wizard opens, allowing you to create a connection.
- Select the type of connection to create: "HFSQL Client/Server".
- Go to the next step.
- In the following steps, specify:
- the server name (name of your computer for example) and the port number.
- the username and password (leave these fields empty to log in as administrator) .
- the database name (in this case, "WD Full Application").
- the name of the connection (keep the default name).
- Go to the next step and validate. The connection to the database is automatically created. A dialog box prompts you to associate the different data files from the analysis with the connection that was just created.
- Click "Yes".
- In the next step, select all the data files:
Go to the next step.
- A dialog box prompts you to copy the data files to the server. Validate ("Copy now").
- Select the analysis data files to be copied to the server: in our case, all data files in the EXE directory.
- Go to the next step and validate.
- The data files in the analysis are automatically changed into HFSQL Client/Server data files and associated with the selected connection.
- Generate the analysis: on the "Analysis" tab, in the "Analysis" group, click "Generation". An automatic modification of the data files is automatically proposed. If all the data files are up to date, the automatic modification of the data files can be canceled.
| | |  | Note | Switching to Client/Server mode: tips- Check the code of your project: in HFSQL Client/Server mode, the HSubstDir statements, ... are useless.
- You can modify the connection defined in the analysis with HOpenConnection and HChangeConnection according to the parameters specified when it was created.
- HOpenConnection is used to go back to HFSQL Classic mode: simply specify the path of the directory containing the HFSQL Classic data files.
|
- The development project was successfully adapted. You may also have to adapt the deployed application (e.g., if the deployed application uses HFSQL Classic data files). This operation is configured when creating the setup program of the application.
Features available in HFSQL Client/Server mode HFSQL Client/Server offers multiple features: These features will not be described here (some of them have been presented in this tutorial in HFSQL Classic mode).
|
|
|
|