|
|
|
|
|
- Configuring the connection
HConnect (Function) In french: HConnecte
Not available with these kinds of connection
Redefines one or more connection parameters via Native Connector (Access, SQL Server, MySQL or Oracle) or via an OLE DB access on a specific table or set of tables. Then, the tables are opened (or created if they do not exist). The specified test operation is run. Remarks: - The new redefinition of the connection will be used until it is canceled by HConnect. It will be automatically canceled at the end of application.
- By default, the connection characteristics are defined in the data model editor, for one or more tables.
| Important- manage advanced parameters available with certain databases (cursors, transactions, etc.),
- handle a named connection.
|
Syntax
<Result> = HConnect(<Table name> [, <User> [, <Password> [, <Database> [, <OLE DB server or Native Connector> [, <Access> [, <Test operation> [, <Optional information>]]]]]]])
<Result>: Boolean - True if the operation was performed,
- False if a problem occurs. HErrorInfo is used to identify the error.
<Table name>: Character string Name of the table (data file) to opened, and for which the connection must be redefined. If no other parameter is specified, the data file is reinitialized with the default parameters defined in the analysis.- If this parameter is equal to "*", the change will apply to all tables handled by the Native Connector (also called Native Access). In this case, all connection parameters must be specified.
- If this parameter is equal to "*" and no other parameters are specified, all data files of all Native Connectors defined in the analysis are reset to the default parameters.
<User>: Optional character string Username that will be used to open the data file. <Password>: Optional character string or secret string Connection password (if this password exists).
New in version 2025Secret strings: The secret string must be of type "Ansi or Unicode string". To learn more about secret strings and how to use the vault, see Secret string vault. <Database>: Optional character string Full path of the data source. <OLE DB server or Native Connector>: Optional character string or constant Name of the OLE DB provider or one of the following constants: | | hAccessHF7 | Pseudo-connection to HFSQL Classic database | hNativeAccessAS400 | Native AS/400 Connector (optional module of WINDEV/WEBDEV) | hNativeAccessDB2 | Native DB2 Connector (optional module of WINDEV/WEBDEV) | hNativeAccessInformix | Native Informix Connector (optional module of WINDEV/WEBDEV) | hNativeAccessMariaDB | Native MariaDB Connector (optional module of WINDEV/WEBDEV) | hNativeAccessMySQL | Native MySQL Connector (optional module of WINDEV/WEBDEV) | hNativeAccessOracle | Native Oracle Connector (optional module of WINDEV/WEBDEV) | hNativeAccessOracleLite | Native Oracle Connector (optional module of WINDEV Mobile) | hNativeAccessPostgreSQL | Native PostgreSQL Connector (optional module of WINDEV/WEBDEV) | hNativeAccessProgress | Native Progress Connector (optional module of WINDEV/WEBDEV) | hNativeAccessSQLAzure | Native SQL Azure Connector (optional module of WINDEV/WEBDEV, provided with the Native SQL Server Connector) | hNativeAccessSQLite | Native SQLite Connector (included with WINDEV/WEBDEV) | hNativeAccessSQLServer | Native SQL Server Connector (optional module of WINDEV/WEBDEV) | hNativeAccessSQLServerMobile | Native SQL Server Connector (optional module of WINDEV Mobile) | hNativeAccessSybase | Native Sybase Connector (optional module of WINDEV/WEBDEV) | hNativeAccessXBase | Native xBase Connector (included with WINDEV/WEBDEV) | hNativeAccessXML | Native XML Connector (provided with WINDEV/WEBDEV) | hODBC | OLE DB provider for ODBC (used to access an ODBC data source declared in the ODBC data sources of Windows) | hOledbAccess97 | OLE DB provider for Access 97 | hOledbAccess2000 | OLE DB provider for Access 2000 | hOledbAccess2007 | OLE DB provider for Access 2007 | hOledbAccess2010 | OLE DB provider for Access 2010 | hOledbDBase5 | OLE DB provider for dBase 5 | hOledbExcel97 | OLE DB provider for Excel 97 | hOledbExcel2000 | OLE DB provider for Excel 2000 | hOledbExcel2007 | OLE DB provider for Excel 2007 | hOledbLotus4 | OLE DB provider for Lotus 4 | hOledbOracle | OLE DB provider for Oracle | hOledbSQLServer | OLE DB provider for SQL Server |
<Access>: Optional constant Configures the type of access to the data file. | | hORead | The data file can be accessed in read-only mode. It is only possible to read records. It is not possible to add or remove records. | hOReadWrite (default value) | The data file can be accessed in read/write mode. It is possible to read and write new records. |
<Test operation>: Optional constant Configure the type of operation that will be performed on the database to check the connection. | | hHCreateIfNotFound (Default value) | Checks the connection by opening or creating a data file (if the data file does not exist). This operation can be performed in hOReadWrite mode only. | hHOpen | Checks the connection by opening a data file. This value is used by default when accessing to an hORead database. |
<Optional information>: Optional character string Information inserted in the database connection string. For example, some data sources allow you to specify the database that will be used. With SQLServer, the "Master" database is the default database but other databases can be used, "dbo" for example. This information is specified in the <Optional information> parameter via the following syntax:
Remarks Configuring the connection - The table description must be known during the call to HConnect (the table must have been described in the analysis, or by HDeclare or HDescribeFile).
- HConnect opens the connection and the table. The table is created if it does not exist. For this specific point, HConnect is equivalent to HCreationIfNotFound.
- When redefining the connection, only the specified parameters are taken into account. The value of parameters not specified by HConnect corresponds to the value defined in the data model editor.
- If only the <Table name> is specified, HConnect cancels the connection redefinition for the specified tables. The parameters specified in the data model editor will be applied.
- When the <Table name> parameter is equal to "*", the change applies to all the Native Connector tables defined in the analysis. In this case, only the <User>, <Password>, <Database> and <Access> parameters are taken into account.
- To cancel a connection change performed on the tables, <Table name> must be equal to "*" and no other parameter must be specified.
- If the data source is specified, HConnect ignores the possible HSubstDir/HChangeDir.
- If a table is open when HConnect is called, the table is closed then reopened with the new connection parameters.
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|