Skip to content

DF_DRIVER_NAME

See Also: Get_Attribute, Set_Attribute, DF_DRIVER_NUMBER_SERVERS, DF_DRIVER_SERVER_NAME

The name of the nth-loaded database driver.

Level

Global

Supported by

The DataFlex SQL Drivers (SQL Server, DB2, and ODBC)

Type

String, temporary

Access

Read only

Values

String representing a driver name

Syntax

Use cli.pkg
Get_Attribute DF_DRIVER_NAME of {driverNumber} to {StringVariable}

Driver Configuration Keyword

None

Remarks

Unlike other global attributes, this global attribute is indexed. To access the value of this attribute, use the fileNum parameter of the Get_Attribute command to represent the position of the driver in the driver table.

For example, to get the name of the second driver in the driver table, you could use the following command:

Get_Attribute DF_DRIVER_NAME of 2 to sDriverName

The string variable sDriverName will contain the name of the second driver, if there is one.

The number of drivers may be determined by getting the value of the DF_NUMBER_DRIVERS attribute. We usually refer to database drivers with the term "driver." In the discussion of this topic, we use both terms.

By default, there is always at least one database driver loaded. This is the driver that handles the Embedded Database. It reports its name as “DATAFLEX.” Other drivers are loaded dynamically. How many drivers are loaded depends on program logic. A driver will be loaded if:

  • There is an entry in the dfini.cfg file to load the driver on startup. The entry should be “4096=”.
  • An explicit Load_Driver command is executed.
  • The first action on the driver is done (implicit loading). For example, if one opens a table accessed via the SQL Server Driver, it will be loaded automatically.

Example

This example enumerates all loaded drivers and lists them:

Procedure ShowDriverList
    Integer iNumDrivers iDriver
    String sDriver
    Get_Attribute DF_NUMBER_DRIVERS To iNumDrivers
    For iDriver From 1 To iNumDrivers
        Get_Attribute DF_DRIVER_NAME of iDriver to sDriver
        Showln "Driver: " sDriver
    Loop
    Showln
    Showln "Done..."
End_Procedure // ShowDriverList