- Lookup table between the different types of databases, their sources and their databases
- Failure or success of connection
- Connection to an HFSQL analysis
- ODBC and OLE DB: Nesting connections
- Connection to a database using ODBC
- Native MySQL, MariaDB and PostgreSQL Connectors
- Native MySQL, MariaDB and PHP Connectors
- Connection to an ISAM database via ACCESS
- Using a connection with NT authentication
- Oracle Native Connector: external authentication management
- SQL query (HExecuteSQLQuery or queries created in the query editor)
- Connection to an HFSQL database in Java
SQLConnect (Function) In french: SQLConnecte Connects the current application to a database that must be interrogated via SQL. Syntax
<Result> = SQLConnect(<Source> , <User> , <Password> [, <Database name> [, <Database type> [, <OLE DB provider> [, <Optional information>]]]])
<Result>: Integer - Connection identifier: this identifier is used by the SQLChangeConnection function.
- 0 if an error occurs. To find out the error details, use SQLInfo.
<Source>: Character string Name of the data source (also called Data Source Name). If the data source contains several "Databases", you must specify the name of the "Database" used (<Database name> parameter). For more details, see the remarks. <User>: Character string Username. This name is optional for some data sources: in this case, use an empty string ("") for this parameter..
<Password>: Character string or Secret string Password corresponding to the specified user. This password is optional for some data sources: in this case, use an empty string ("") for this parameter..
New in version 2025Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "Ansi or Unicode string". To learn more about secret strings and how to use the vault, see Secret string vault. <Database name>: Optional character string Name of the database to use. For more details, see the Remarks.- If this parameter is specified, a dialog box specific to the driver is displayed during the connection. This dialog box may not be displayed according to the driver used.
- If this parameter is not specified, no dialog box is displayed.
<Database type>: Optional character string Type of accessed database. The types of databases installed on the current computer are returned by SQLListSource. For more details, see the remarks. <OLE DB provider>: Optional character string or constant Name of OLE DB provider used. The most common ones are as follows: | | "SQLOLEDB" | SQLServer | "MSDASQL" | ODBC | "Microsoft.Jet.OLEDB.3.51" | Access | "Microsoft.Jet.OLEDB.4.0" | Access | "MSDAORA" | Oracle (Microsoft) | "OraOLEDB.Oracle" | Oracle | or one of the following constants: | | hODBC | OLE DB provider for ODBC. Used to access an ODBC 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. |
Caution: To use an OLE DB connection, you must:
- install MDAC version 2.6 or later (setup performed by WINDEV or WEBDEV when installing the application)
- install the OLE DB provider corresponding to the database used.
<Optional information>: Optional character string (not to be used with HFSQL or direct ODBC) Used to specify the optional information. You can for example specify "Trusted_Connection=YES" in order to use a connection with authentication via the NT login. If several optional information must be specified, they must be grouped in a single character string and they must be separated by the ";" character.
Remarks Lookup table between the different types of databases, their sources and their databases | | | Database type | Source | Database name |
---|
ACCESS | Name of the Access file | "" (empty string) | AS400 | Native AS/400 Connector (optional module) | | DB2 | Native DB2 Connector (optional module) Source defined in ODBC Administrator. | "" (empty string) or Database | HYPER FILE HFSQL | Database name | "" (empty string) | HFSQLCS | Server name or address | Database name | INFORMIX | Native Informix Connector (optional module) | | JDBC | URL for connecting to the database. This URL is specific to each driver. | The database must be specified in the connection URL. This URL is specific to each JDBC driver. | HIVE | URL for connecting to the Hive server. | Database | MariaDB | Native MariaDB Connector (optional module) Database name | Database | MySQL | Native MySQL Connector (optional module) Database name | Database | POSTGRESQL | Native PostgreSQL Connector (optional module) Database name | Database | ODBC | Source defined in ODBC Administrator | "" (empty string) or Database | OLEDB | Source name | "" (empty string) | ORACLE | Native Oracle Connector (optional module) Name of the alias defined in SQL NET Easy configuration and in WDORAINS. | "" (empty string) | PROGRESS | Native Progress Connector (optional module) Source defined in ODBC Administrator. | "" (empty string) or Database | SQL AZURE | Native SQL Azure Connector (optional module supplied with the Native SQL Server Connector) Server name. If the server name is: ServerName.database.windows.net, the login must be in the form: login@ServerName. | Database | SQL SERVER | Native SQL SERVER Connector (optional module) Server name. | "" (empty string) | Sybase | Native SYBASE Connector (optional module) Name of server or its alias. | "" (empty string) | xBase | Native xBase Connector (supplied with the product) | | | Database available via a browser (available in Chrome and Safari only) "" (empty string) | "" (empty string) |
Failure or success of connection If the connection is successful, the connection identifier can be used to change the connection ( SQLChangeConnection). If the connection fails, the SQL.Error and SQL.MesError variables are not initialized. For more details about the connection failure, use SQLInfo. In any case (failure or success), the connection must be closed ( SQLDisconnect).
This page is also available for…
|
|
|