f$SQLDriverConnect
f$SQLDriverConnect
Make an ODBC connection to a database. The channel number returned must be given for all following access attempts.
Note: since it takes time to make the connection, a new connection should not be established for every SQL function.
Hint:
The f$SQLDriverConnect function can also use file data sources. Compared to user or system data sources, these offer the advantage of not having to be installed on every ePOS user PC and can instead be created (and transported) on a central network drive.
A connection to a database can be made with f$SQLDriverConnect without needing data sources. All required connection information must be entered in the connection string to do that.
Unlike f$SQLConnect, additional connection information can also be entered here (see the respective database documentation).
Syntax: | Channel = f$SQLDriverConnect( ConnectStr ) | ||
| Argument | Type | Meaning |
| ConnectStr | String | Text with connection information for the database. |
Result: | Integer | Channel number or –1 if the connection cannot be established. | |
Examples: | Using a file data source: Using a user data source without log-in information: Connect directly to a database: CN = 'DRIVER=SQL Server;SERVER=DBSQLSERVER;DATABASE=SMP_NG;UID=SMP;PWD=smp' Channel = f$SQLDriverConnect( CN ) Connect directly to an Excel work folder Excelfile = 'C:\\Temp\\example.xls'; CN = 'DRIVER=Microsoft Excel Driver (*.xls);DBQ=' + Excelfile; Channel = f$SQLDriverConnect( CN ) | ||