- In this lesson you will learn the following concepts
- Installing a local HFSQL server
- Creating a site that uses an HFSQL Client/Server database
- Adapting a site to use an HFSQL Client/Server database
- Adapting the example
- Features available in HFSQL Client/Server mode
Lesson 11.2. Implementing a Client/Server database
In this lesson you will learn the following concepts
- Installing a local HFSQL server.
- Creating a site that uses an HFSQL Client/Server database.
- Adapting a site to manage an HFSQL Client/Server database.
- Features available in Client/Server mode.
Estimated time: 10 mn
In this lesson, we will perform all the operations required to develop and deploy a site 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). In the deployment phase, the server can be installed on a specific computer or directly on the server that hosts your site.
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.
|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.
|For security reasons, don't forget to change the administrator password.|
- If the HFSQL Control Center is not installed or is not accessible from your computer, check the option "Install the HFSQL Control Center".
|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 installation 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 a site that uses an HFSQL Client/Server database
Creating a WEBDEV site 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.
|You can also define the connection to the HFSQL server programmatically. For more details, see the online help: "HDescribeConnection".|
Adapting a site to use an HFSQL Client/Server database
Switching an HFSQL Classic database to Client/Server is the most common operation.
WEBDEV includes multiple solutions to perform this operation:
- from the data model editor.
- from the HFSQL Control Center.
To better understand the different steps, we are going to switch the site we created in part 4 to Client/Server using the analysis editor.
Adapting the example
- We are going to adapt the "Full WEBDEV Site" project to use a Client/Server database.
- If necessary, open the project you worked on in the previous lessons.
- Go to the WEBDEV home page (Ctrl + <).
- On the home page, click "Tutorial", then in "Parts 11 and 12", double-click "Full WEBDEV Site (Exercise)".
- A dialogue box prompts you to open the project you worked on in the previous lessons. You can open the local copy or the original project. Select "Open the local copy".
|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 "Parts 11 and 12", double-click "Full WEBDEV Site (Answers)".|
- To adapt the project:
- Load the analysis of your project in the data model editor: click in the quick access buttons of the WEBDEV menu. The data model editor is displayed.
- In the ribbon, 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 name of the server on which the HFSQL Client/Server server was installed (localhost if it was installed on your computer, for example), and the port number.
- the username and password (to use the administrator, specify the login credentials defined when the HFSQL server was installed).
- the database name ("Full_WEBDEV_Site" in our example).
- Define the connection name (keep the default name).
- Go to the next step and validate. The connection to the database is automatically created. The wizard prompts you to associate the different data files in the analysis with the connection that has just been 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: In the ribbon, 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.
|Switching to Client/Server mode: tips|
- Check the code of your project : in HFSQL Client/Server mode, HSubstDir and other similar statements have no effect.
- 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 site (if the deployed site uses HFSQL Classic data files, for example). This operation is configured when creating the site setup program.
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).
Click [Add] to post a comment