Skip to main content
Skip table of contents

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.
General connection: a list in the form "<key>=<value>", separated by ";". The list cannot contain any spaces as separators (though spaces are allowed as part of the value).
One key from the following list must be given for identifying the database:
DSN: name of the user or system data source
FILEDSN: name of the file data source (including extension)
DRIVER: name of the ODBC driver
For making a connection also the following:
UID: user name (value can remain empty)
PWD: password (value can remain empty)
as well as other keys according to the database accessed (see documentation for the corresponding driver)

Result:

Integer

Channel number or –1 if the connection cannot be established.

Examples:

Using a file data source:
Channel = f$SQLDriverConnect( 'FILEDSN=Article.dsn;UID=Smith;PWD=abc' )

Using a user data source without log-in information:
Channel = f$SQLDriverConnect( 'DSN=Standard article;UID=;PWD=' )

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 )

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.