PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Syntax 1: Using a character string for the OLE DB provider
  • Syntax 1: Pseudo-connection to HFSQL Classic database
  • Differences between HOpenConnection and HDescribeConnection
  • Using the native xBase access with non-Latin character sets
  • UDL file
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
Describes a new connection to an external database. This connection is named. Specific parameters can be defined such as the management mode of cursors (if the accessed database allows it).
To associate this connection with a table or a data file, use HChangeConnection.
To establish the connection, use HOpenConnection. If the connection parameters described by HDescribeConnection are incorrect, HOpenConnection will return an error.
With HDescribeConnection, a description of Oracle table imported into the analysis can be directly used by HFSQL Classic data files. All you have to do is describe a temporary connection to a HFSQL Classic database and associate it with the file description found in the analysis. See the Examples for more details.
This function is kept for backward compatibility. We recommend that you use a connection variable and its properties to describe a connection.
PHP Only the access to a MySQL database or to an AS/400 database is allowed.
PHP Only the access to a MySQL database, MariaDB database or to an AS/400 database is allowed.
Versions 17 and later
WINDEV MobileiPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
WINDEV MobileiPhone/iPad This function is now available for the iPhone/iPad applications.
WINDEV MobileiPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
WINDEVWINDEV MobileUniversal Windows 10 App This function is now available in Windows Store apps mode.
WINDEV MobileAndroid Widget This function is now available in Android Widget mode.
New in version 18
WINDEVWINDEV MobileUniversal Windows 10 App This function is now available in Windows Store apps mode.
WINDEV MobileAndroid Widget This function is now available in Android Widget mode.
WINDEVWINDEV MobileUniversal Windows 10 App This function is now available in Windows Store apps mode.
WINDEV MobileAndroid Widget This function is now available in Android Widget mode.
Versions 21 and later
WINDEVWINDEV MobileUniversal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
WINDEVWINDEV MobileUniversal Windows 10 App This function is now available in Universal Windows 10 App mode.
WINDEVWINDEV MobileUniversal Windows 10 App This function is now available in Universal Windows 10 App mode.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
WINDEVWEBDEV - Server codeWINDEV MobileReports and QueriesWindows MobileAjaxUser code (UMC)HFSQL Client/ServerOLE DBNative Accesses
HDescribeConnection("MyConnection", "", "", ...
"Server_SQLServer", "dbo", hNativeAccessSQLServer, hOReadWrite, "")
Syntax

Describing a connection by programming Hide the details

<Result> = HDescribeConnection(<Connection Name> , <User Name> [, <Password>] , <Data Source> , <Database> , <OLE DB Provider or Native Access> [, <Access> [, <Extended Information>]] , <Additional Options>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error.
To establish this connection, use HOpenConnection (this function will return an error if the connection parameters are incorrect).
To assign this connection to a data file, use HChangeConnection.
<Connection Name>: Character string (with quotes)
Name of new connection to define.
If this name is already used by an existing connection, the former connection is replaced by the new one. The former connection (as well as the data files that used it) are automatically closed.
<User Name>: Character string (with quotes)
User name that will be used for the database. This parameter is returned by ..CtUserName.
<Password>: Optional character string (with quotes)
Connection password (if this password exists). If no password is required, use an empty string ("") or the NULL keyword.
<Data Source>: Character string (with quotes)
Full path of data source. The connection will be created and opened for this data source. This parameter is returned by ..CtDatabase.
Native Accesses XML: This parameter corresponds to the name of XML file.
HFSQL Client/Server This parameter corresponds to the server name. The port number used by the HFSQL server can be specified. The port 4900 will be used by default. If the port number of the HFSQL server is different, use the following notation:
<Computer Name>: <Port Number>
Example: "ComputerName:4901".
For a use via Internet, the ports must be managed by Firewall. See Managing ports for more details.
Versions 15 and later
You have the ability to specify an IPv6 address by writing the IPv6 address between square brackets. In this case, the port number must be specified after the closing square bracket. For example: [0154:2145:2155::5554]:4900.
New in version 15
You have the ability to specify an IPv6 address by writing the IPv6 address between square brackets. In this case, the port number must be specified after the closing square bracket. For example: [0154:2145:2155::5554]:4900.
You have the ability to specify an IPv6 address by writing the IPv6 address between square brackets. In this case, the port number must be specified after the closing square bracket. For example: [0154:2145:2155::5554]:4900.
Java Access by JDBC:
  • This parameter corresponds to URL for connecting to the database.
  • Depending on the JDBC driver used, the database name must be specified in the connection URL.
AndroidAndroid Widget For an Android application:
  • Versions 18 and later
    Connection to a HFSQL Client/Server database:
    • The database is found on the development computer and it is handled from an Android emulator: use the IP address 10.0.2.2 with the server port. Example: "10.0.2.2:4900"
    • The database is found on the network of the development computer and it is handled from an Android emulator: use the full name of server with the domain. Example: "Server@domain.com:4900" (with the WINDEV Mobile simulator, the computer name without domain may be sufficient).
    New in version 18
    Connection to a HFSQL Client/Server database:
    • The database is found on the development computer and it is handled from an Android emulator: use the IP address 10.0.2.2 with the server port. Example: "10.0.2.2:4900"
    • The database is found on the network of the development computer and it is handled from an Android emulator: use the full name of server with the domain. Example: "Server@domain.com:4900" (with the WINDEV Mobile simulator, the computer name without domain may be sufficient).
    Connection to a HFSQL Client/Server database:
    • The database is found on the development computer and it is handled from an Android emulator: use the IP address 10.0.2.2 with the server port. Example: "10.0.2.2:4900"
    • The database is found on the network of the development computer and it is handled from an Android emulator: use the full name of server with the domain. Example: "Server@domain.com:4900" (with the WINDEV Mobile simulator, the computer name without domain may be sufficient).
  • Connection to a SQLite database:
    Full path of the file containing the SQLite database on the Android device.
    Example : /sdcard/bdd/MyDatabase.db
    If the parameter corresponds to an empty string (""), the file containing the database data will be created in the "databases" directory of application and its name will be identical to the application name followed by the ".db" extension.
<Database>: Character string (with quotes)
Name of database that will be used on the data source, empty string ("") if no name must be specified. This parameter can be used if the data source allows you to specify the database that must be used.
For example, on SQL Server, the "Master" database is the default database but other databases can be handled ("dbo" for example).
To specify that the access is performed on a file found in the "dbo" database (that is not the default database), <Database> must correspond to "dbo".
This parameter is returned by ..CtInitialCatalog.
<OLE DB Provider or Native Access>: Character string or constant
  • Name of OLE DB provider used. To easily retrieve the string to use, select "Connection" in the data model editor (see the Notes).

    or
  • one of the following constants:
    hAccessHF7Pseudo-connection to HFSQL Classic database
    hAccessHFClientServerNative Access to HFSQL Client/Server database
    hNativeAccessAS400Native AS/400 Access (optional module of WINDEV/WEBDEV)
    hNativeAccessDB2Native DB2 Access (optional module of WINDEV/WEBDEV)
    hNativeAccessInformixNative Informix Access (optional module of WINDEV/WEBDEV)
    Versions 20 and later
    hNativeAccessMariaDB
    New in version 20
    hNativeAccessMariaDB
    hNativeAccessMariaDB
    Native MariaDB Access (optional module of WINDEV/WEBDEV)
    hNativeAccessMySQLNative MySQL Access (optional module of WINDEV/WEBDEV)
    hNativeAccessOracleNative Oracle Access (optional module of WINDEV/WEBDEV)
    hNativeAccessOracleLiteNative Oracle Access (optional module of WINDEV Mobile)
    hNativeAccessPostgreSQLNative PostgreSQL Access (optional module of WINDEV/WEBDEV)
    hNativeAccessProgressNative Progress Access (optional module of WINDEV/WEBDEV)
    Versions 16 and later
    hNativeAccessSQLAzure
    New in version 16
    hNativeAccessSQLAzure
    hNativeAccessSQLAzure
    Native SQL Azure Access (optional module of WINDEV/WEBDEV supplied with Native SQL Server Access)
    Versions 16 and later
    hNativeAccessSQLite
    New in version 16
    hNativeAccessSQLite
    hNativeAccessSQLite
    Native SQLite Access (supplied with WINDEV/WEBDEV)
    hNativeAccessSQLServerNative SQL Server Access (optional module of WINDEV/WEBDEV).
    The former native access is used by default. To force the use of new Native SQL Server Access, use the H.SQLServerMode variable.
    hNativeAccessSQLServerMobileNative SQL Server Mobile Access (optional module of WINDEV Mobile)
    hNativeAccessSybaseNative Sybase Access (optional module of WINDEV/WEBDEV)
    hNativeAccessXBaseNative xBase Access (supplied with WINDEV/WEBDEV)
    hNativeAccessXMLNative XML Access (supplied with WINDEV/WEBDEV)
    hODBCOLE DB provider for ODBC (used to access an ODBC data source declared in the ODBC data sources of Windows)
    hOledbAccess97OLE DB provider for Access 97
    hOledbAccess2000OLE DB provider for Access 2000
    hOledbDBase5OLE DB provider for dBase 5
    hOledbExcel2000OLE DB provider for Excel 2000
    hOledbExcel97OLE DB provider for Excel 97
    hOledbLotus4OLE DB provider for Lotus 4
    hOledbOracleOLE DB provider for Oracle
    hOledbSQLServerOLE DB provider for SQL Server
Windows Mobile The available constants are as follows:
hAccessHF7Pseudo-connection to HFSQL Mobile database
hAccessHFClientServerConnection to HFSQL Client/Server database
hNativeAccessOracleLiteNative Oracle Lite Access (optional module)
hNativeAccessSQLServerMobileNative SQL Server Mobile Access (optional module)
AndroidAndroid Widget The available constants are as follows:
Versions 15 and later
hNativeAccessSQLite
New in version 15
hNativeAccessSQLite
hNativeAccessSQLite
Native SQLite Access from an Android application.
OLE DB Caution: To use an OLE DB connection, you must:
  • install MDAC version 2.6 or later (setup performed by WINDEV/WEBDEV and when creating the client version)
  • install the OLE DB provider corresponding to the database used.
    This parameter is returned by ..CtOLEDBProvider.
Java The available constants are as follows:
hAccessHF7Pseudo-connection to HFSQL Mobile database
hAccessHFClientServerConnection to HFSQL Client/Server database
hAccessJDBCMySQLAccess to MySQL database via JDBC
Versions 15 and later
hAccessJDBCSQLite
New in version 15
hAccessJDBCSQLite
hAccessJDBCSQLite
Access to SQLite database via JDBC
hAccessJDBCSQLServerAccess to SQL Server database via JDBC
PHP This parameter can correspond to one of the following constants:
hNativeAccessAS400Native AS/400 Access (optional module of WEBDEV)
Versions 20 and later
hNativeAccessMariaDB
New in version 20
hNativeAccessMariaDB
hNativeAccessMariaDB
Native MariaDB Access (optional module of WINDEV/WEBDEV)
hNativeAccessMySQLNative MySQL Access (optional module of WEBDEV)
Versions 15 and later
hNativeAccessOracle
New in version 15
hNativeAccessOracle
hNativeAccessOracle
Native Oracle Access (optional module of WEBDEV)
Versions 15 and later
hNativeAccessPostgreSQL
New in version 15
hNativeAccessPostgreSQL
hNativeAccessPostgreSQL
Native PostgreSQL Access (optional module of WEBDEV)
<Access>: Optional constant
Configures the type of access to the database.
hOReadWrite
(default value)
The database can be accessed in read/write. You have the ability to read the records and to write new records.
hOReadThe database can be accessed in read-only. You only have the ability to read the records. No record can be added or deleted.
This parameter is returned by ..CtAccess.
PHP This parameter is not available.
Java Access by JDBC: This parameter is ignored.
<Extended Information>: Optional character string (with quotes)
Optional information inserted into the string for connecting to the database. If specific keywords are recognized, the corresponding information is extracted from the connection string. The rest of the connection string is sent to the database. Then, the extracted parameters are processed by the native access or by the OLE DB access used.
These keywords must be indicated as follows: "<Keyword> = <Value>;".
You can for example specify "Trusted_Connection=YES" in order to use a connection with authentication via the NT login.
OLE DBNative Accesses The keywords recognized by OLE DB and the native accesses are presented in the page named Optional connection information.
Example of string to use:
"WD Cache Size = 10000; Server Port=3306;"
HFSQL Client/Server Keywords recognized for the access by HFSQL Client/Server:
COMPRESSIONEnables or disables the compression of the data sent between the Client and the Server. This keyword can correspond to:
  • TRUE to enable the data compression.
  • FALSE to disable the data compression.
ENCRYPTIONEnables the encryption of the data exchanged between the Client and the Server. This keyword can take two values:
  • FAST
  • RC5_16 for a RC5 encryption (16 rounds).
DB_EXISTChecks the existence of the database. If the specified database does not exist, HDescribeConnection returns False.
This parameter is returned by ..CtExtendedInfo.
PHP This parameter is ignored.
Java HFSQL database accessed via a RMI server: This parameter corresponds to the address of RMI server and to the port used. The following format must be used: "RMI=<Server Address>:<Port Number>". For example: "RMI=192.168.52.148:1099".
Java Access by JDBC: This parameter is mandatory. It must correspond to the full name of JDBC driver to use. This name is case sensitive.
<Additional Options>: Constant
If this parameter is not specified, the HFSQL engine automatically defines the best parameters to use according to the database accessed and to the OLE DB provider used.
To force some parameters, you have the ability to combine the following constants:
  • Location of cursors
    hClientCursorCursor managed by MDAC. Offers more features than a server cursor. A client cursor must necessarily be a static cursor.
    hServerCursorCursor managed by the database. This cursor can easily apply the changes performed by the other users to the data.
  • Type of cursor
    hDynamicCursorCursor offering a lot of features but consuming a lot of memory. This cursor allows all types of moves. It allows you to access all the modifications, additions and deletions performed by the other users.
    hForwardOnlyCursorFast cursor consuming little memory. The move is performed from the first record to the last one. The data modified by the other users is not visible.
    hOpenKeysetCursorCursor that handles a fixed set of records. Only the keys corresponding to the record are stored and not the records (consumes less memory). The deleted records can no longer be accessed. The modifications performed by the other users are visible (but not the additions).
    hStaticCursorRetrieves a copy of all the query records in memory (consumes a lot of memory). All types of moves are allowed.
  • Lock mode
    hReadOnlyCursorThe set of records cannot be modified.
    hOptimisticCursorThe record is locked when it is updated
    hPessimisticCursorThe record is locked as soon as it becomes in edit to be modified.
Caution: some types of cursors may not be supported by all the OLE DB providers.
This parameter is returned by ..CtCursorOptions.
Windows MobilePHP This parameter is ignored.
WINDEVWEBDEV - Server codeAjaxUser code (UMC)

Describing a connection from an ADO connection string Hide the details

<Result> = HDescribeConnection(<Connection Name> , <ADO Connection String> [, <Access>])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error.
<Connection Name>: Character string (with quotes)
Name of new connection to define. If this name is already used by an existing connection, the former connection is replaced by the new one. The former connection (as well as the data files that used it) are automatically closed.
<ADO Connection String>: Character string (with quotes)
ADO connection string used. See the documentation supplied by the OLE DB provider for more details.
<Access>: Optional constant
Configures the type of access to the database.
hOReadWrite
(default value)
The database can be accessed in read/write. You have the ability to read the records and to write new records.
hOReadThe database can be accessed in read-only. You only have the ability to read the records. No record can be added or deleted.
Remarks
WINDEVWEBDEV - Server codeReports and QueriesPHPAjaxUser code (UMC)HFSQL Client/ServerOLE DBNative Accesses

Syntax 1: Using a character string for the OLE DB provider

To easily find the character string that must be used to define the OLE DB provider, we recommend that you proceed as follows:
  1. In the data model editor, display the description window of the connection ("Analysis .. Connection").In the data model editor, display the description window of the connection: on the "Analysis" pane, in the "Connections" group, click "Connections".
  2. Select the provider to use ("Connect via" combo box).
  3. The character string corresponding to the provider is displayed. This character string can be used to define the OLE DB provider used in <OLE DB Provider>.
WINDEVWEBDEV - Server codeWINDEV MobileReports and QueriesWindows MobilePHPAjaxUser code (UMC)OLE DBNative Accesses

Syntax 1: Pseudo-connection to HFSQL Classic database

OLE DB data files or native data files are described in the data model editor. To handle these descriptions by programming with a HFSQL database, all you have to do is specify the hAccessHF7 constant as provider name.
Then, this connection can be assigned to the data files affected by HChangeConnection.
The data files in HFSQL format corresponding to the description of the OLE DB or native files will be created (if necessary) in the directory defined by <Data Source>. By default, these data files are empty when they are created.

Differences between HOpenConnection and HDescribeConnection

Method 1: To open a connection at the beginning of the application and to close it at the end, use HOpenConnection. To use this connection when handling the data files or tables, all you have to do is change this connection with HChangeConnection.
HOpenConnection(MyConnection, params)       // open the connection
HChangeConnection(AFile, MyConnection)
Method 2: To describe a connection by programming and to automatically open it when opening the data file, you must:
  • describe the connection with HDescribeConnection.
  • associate this connection with the description of data file via HChangeConnection. The connection will be established during the first access to the data file.
This solution can be useful when an application handles both HFSQL data files and Oracle data files. For example, if the application is using a single Oracle file in a very specific process, the connection to the Oracle database will be established when it is required.
If the first solution is chosen for the same type of application, the connection (that may take quite a long time) will be established whenever the application is started.
Example:
HDescribeConnection(MyConnection, params)
HChangeConnection(AFile, MyConnection)
...
HReadFirst(AFile) // Open the connection
...
HClose(AFile) // Close the connection
WINDEVWEBDEV - Server codeNative Accesses

Using the native xBase access with non-Latin character sets

To use the native xBase access with non-Latin character sets, a standard OEM/ANSI conversion must be performed by the native access. To do so, the following string must be specified in the extended information:
OEMTOANSI=WINDOWS;
Example:
  1. In the initialization code of the project, add the code used to modify the character set:
    ChangeCharset(charsetChinese)
  2. Create an xBase connection:
    HDescribeConnection("CntxBase", "", "", fExeDir(), "", hNativeAccessXBase, hOReadWrite, ...
    "OEMTOANSI=WINDOWS;")
    HChangeConnection("*", "CntxBase")
WINDEVWEBDEV - Server codeWINDEV MobileReports and QueriesWindows MobileAjaxUser code (UMC)OLE DB

UDL file

To create a UDL file:
  1. Create a text file whose extension is "UDL".
  2. Double-click this file. The window for the properties of the data links is opened.
  3. Configure the connection.
  4. Run the test of the connection.
  5. Validate ("OK" button). The UDL file can now be used.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230hf.dll
Windows Mobile wp230hf.dll
Java wd230java.jar
Linux wd230hf.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment