DF_DRIVER_SERVER_NAME
See Also: Get_Attribute, Set_Attribute, DF_DRIVER_NAME, DF_DRIVER_NUMBER_SERVERS
The name of a connection for a driver.
Level
Global
Supported by
The DataFlex SQL Drivers (SQL Server, DB2, and ODBC)
Type
String, temporary
Access
Read only
Values
String representing a server name.
Syntax
Get_Attribute DF_DRIVER_SERVER_NAME of {driverNumber} {serverNumber} 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 {table-handle} and {field-num} parameter of the Get_Attribute command to represent the position of the driver in the driver table and the ordinal position of the connection.
As an example, to get the name of the third connection of the second driver in the driver table, you could use the following command:
Get_Attribute DF_DRIVER_SERVER_NAME of 2 3 to sServer
The string variable sServer will contain the name of the third connection of the second driver.
The contents of the connection name string depend on the driver that is used. The Embedded Database driver does not support connections (in theory, there’s always one connection). The DataFlex SQL Drivers typically show a connect string as the name or, when using managed connections, the connection ID (e.g., "DFCONNID=MySQLOrder_Uid"). For the DataFlex Pervasive.SQL Driver, the server name will be a database Uniform Resource Indicator (URI) in case the database mode is set to use URIs; otherwise, it does not support connections (like the Embedded Database, there’s always one connection).
We usually refer to database drivers with the term "driver." In the discussion of this topic, we use both terms.
Example
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
Send Info_Box "Done"
End_Procedure
This example enumerates all loaded database drivers and lists them. For each individual driver, the names of all the open connections are listed.