PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Overview
  • Defining the connections from the data model editor
  • Encrypting a connection
  • Defining the connections by programming
  • Defining a connection with HDescribeConnection or HOpenConnection
  • Defining a connection via the Connection type
  • Allowing a WINDEV application to use a HFSQL Client/Server database or a HFSQL Classic database
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
In order for the application to be able to handle the data files found on the HFSQL server, the connection that will be used by the application must be defined in the project. The connection can be defined:
  • from the data model editor.
  • by programming.
You also have the ability to allow an application to use a HFSQL Client/Server database or a HFSQL Classic database.
The data files accessed by a HFSQL server are accessible via this server only. They cannot be directly accessed by another application especially via the HFSQL Classic engine. A connection to the server is required to access these data files.
Note: Several connections can be defined if the application is using several databases or several servers.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Defining the connections from the data model editor
To define a connection from the data model editor:
  1. Select "Analysis .. Connections". The window of defined connections is displayed.
    Note:
    • If no connection was defined, the wizard for creating a connection starts.
    • If connections are defined, click the "New connection" icon ( ). The wizard for defining a new connection starts.
    On the "Analysis" pane, in the "Connection" group, click "New connection". The wizard for defining a new connection starts.
  2. Keep "HyperFileSQL Client/Server" and go to the next wizard plane.Keep "HFSQL Client/Server" and go to the next wizard plane.
  3. In the different wizard screens, enter the requested information:
    • server name,
    • number of the network port,
    • name and password of the user,
    • database,
    • name and caption of the connection.
  4. Validate the wizard.
    A dialog box allows you to associate the data files with this new connection. Accept.
  5. Select the data files to associate and validate. The existing data files can be directly copied onto the HFSQL server. This operation can be performed later if necessary.
  6. The new connection is displayed in the list of connections defined in the analysis. If you have defined the first connection of the analysis, display the list of connections via "Analysis .. Connections". Display the list of connections: on the "Analysis" pane, in the "Connection" group, click "Connections".
    • Run the test of this new connection if necessary: click the "Run the test" button.
    • The different tabs are used to view and modify the characteristics of the connections:
      • "Properties" tab: characteristics of the connection defined in the wizard (name, caption, type, ...)
      • "Advanced" tab: Port number of the connection, options for compressing and encrypting the connection data.
        If the data files that use the connection are encrypted, the connection should be encrypted as well.
      • "Used by" tab: List of data files that use the connection.
  7. Close the window of defined connections.
At run time, the connection associated with the data file used will be automatically opened during the first access to this data file.
The data files associated with a "HyperFileSQL Client/Server" connection are automatically changed into "HyperFileSQL Client/Server" data files.
To identify them, a "HF/CS" indication is displayed at the bottom of the graphic description of these files. Furthermore, the color associated with this area becomes orange:
The data files associated with a "HFSQL Client/Server" connection are automatically changed into "HFSQL Client/Server" data files.
To identify them, a "HFSQL/CS" indication is displayed at the bottom of the graphic description of these files. Furthermore, the color associated with this area becomes orange:

Encrypting a connection

To encrypt a connection:
  1. Display the description of the connection ("Analysis .. Connections"). Display the description of the connection: on the "Analysis" pane, in the "Connection" group, click "Connections".
  2. Select the connection to encrypt.
  3. Display the "Advanced" tab.
  4. Select the encryption mode: Fast or RC5 (16 rounds).
  5. Validate.
Note: If the data files that use the connection are encrypted, the connection should be encrypted as well.
Defining the connections by programming
Several methods can be used to define a connection by programming:

Defining a connection with HDescribeConnection or HOpenConnection

To define a connection with HDescribeConnection or HOpenConnection:
1. Define the connection via HDescribeConnection or HOpenConnection.
The <Data Source> parameter must correspond to the name or IP address of the server that will be used. If the network port to use differs from the default port (port 4900), <Data Source> must have the following format:
"<NameOrIPAddressOfServer>:<PortNumber>".
The <OLEDB Provider or Native Access> parameter must correspond to the hAccessHFClientServer constant.
For example:
HDescribeConnection("MyConnection", "Julia", "Password", "MyHFServer", ...
"MyDatabase", hAccessHFClientServer, hORead)
or
HOpenConnection("ConnectionServer", "Stephen", "", "DataServer:5400", ...
"MyData", hAccessHFClientServer)
2. Open the connection with HOpenConnection.
This step is not required if the connection was defined and opened by HOpenConnection beforehand.
3. Associate the connection with the different data files via HChangeConnection.
For example:
HChangeConnection(Customer, "MyConnection")
or, to associate all the analysis files with the connection:
HChangeConnection("*", "ConnectionServer")
Note: To encrypt the connection, all you have to do is specify the specific extended information ("ENCRYPTION = FAST" or "ENCRYPTION = RC5_16". See the documentation about HDescribeConnection or HOpenConnection for more details.

Defining a connection via the Connection type

To define a connection via the Connection type:
  1. Define the connection via the connection type and its properties.
    For example:
    MyConnection is Connection
    // Describe the connection
    MyConnection..User = "USER"
    MyConnection..Password = "PASSWORD"
    MyConnection..Server = "MYSERVER"
    MyConnection..Database = "Database"
    MyConnection..Provider = hAccessHFClientServer
    MyConnection..Access = hOReadWrite
    MyConnection..ExtendedInfo = "Extended information"
    MyConnection..CursorOptions = hClientCursor
  2. Open the connection with HOpenConnection.
    For example:
    MyConnection is Connection
    // Describe the connection
    MyConnection..User = "USER"
    MyConnection..Password = "PASSWORD"
    MyConnection..Server = "MYSERVER"
    MyConnection..Database = "Database"
    MyConnection..Provider = hAccessHFClientServer
    MyConnection..Access = hOReadWrite
    MyConnection..ExtendedInfo = "Extended information"
    MyConnection..CursorOptions = hClientCursor
Note: To encrypt the connection, all you have to do is use ..CryptMethod on the connection.
For example:
MyConnection is Connection
// Describe the connection
MyConnection..User = "USER"
MyConnection..Password = "PASSWORD"
MyConnection..Server = "MYSERVER"
MyConnection..Database = "Database"
MyConnection..CryptMethod = hCryptRC5_16
MyConnection..Provider = hAccessHFClientServer
MyConnection..Access = hOReadWrite
MyConnection..ExtendedInfo = "Extended information"

HOpenConnection(MyConnection)
Allowing a WINDEV application to use a HFSQL Client/Server database or a HFSQL Classic database
Two WLanguage functions allow you to use any database chosen at run time. Regardless of the type of data files specified in the analysis.
This can be very useful for an application installed on a laptop computer:
  • connected to the network, the application uses the HFSQL Client/Server database,
  • disconnected, the application uses a local copy of the database.
The code that should be used (at the beginning of project, before using the data files) is as follows:
ServerAddress is string = "198.168.1.120"

IF Ping(ServerAddress) THEN
// The server is accessible, HF C/S connection
HOpenConnection("HFCSConnection", "admin", "", ServerAddress, "CRM", hAccessHFClientServer)
    HChangeConnection("*", "HFCSConnection")
    Info("Connected mode to the network database.")
ELSE
  // The server does not respond, use the local HF database
  HOpenConnection("LocalHFConnection", "", "", "C:\Data Directory\", "", hAccessHF7)
  HChangeConnection("*", "LocalHFConnection")
  Info("Disconnected mode, you are using your data locally.")
END
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment