Skip to content

DF_DRIVER_NUMBER_SERVERS

See Also: Get_Attribute, Set_Attribute, DF_DRIVER_NAME, DF_DRIVER_SERVER_NAME

The number of connections open for a driver.

Level

Global

Supported by

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

Type

Integer, temporary

Access

Read only

Values

0 to maximum number of connections allowed for the driver

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 number of connections of the second driver in the driver table, you could use the following command:

Get_Attribute DF_DRIVER_NUMBER_SERVERS Of 2 To iNumConnections

The integer variable iNumConnections will contain the number of connections for the second driver, if there is one.

The DF_DRIVER_NUMBER_SERVERS attribute is global and should work on any driver in the driver table. When used on the Embedded Database driver (DATAFLEX), an exception occurs.

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.

Procedure ShowServerList
    Integer iNumDrivers iDriver iNumServers iServer
    String sDriver sServer

    Get_Attribute DF_NUMBER_DRIVERS To iNumDrivers
    For iDriver From 1 To iNumDrivers
        Get_Attribute DF_DRIVER_NAME of iDriver to sDriver
        Showln "Servers for driver " sDriver ":"

        If (sDriver <> "DATAFLEX") Begin
            Get_Attribute DF_DRIVER_NUMBER_SERVERS of iDriver to iNumServers
            For iServer From 1 To iNumServers
                Get_Attribute DF_DRIVER_SERVER_NAME Of iDriver iServer to sServer
                Showln "  " sServer
            Loop
        End
    Loop

    Showln
    Showln "Done..."
End_procedure // ShowServerList

This example enumerates all loaded database drivers and lists them. For each individual driver, the names of all the open connections are listed.