Purpose
Retrieves information about the active database connections. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
Server_ConnectInfo( ConnectionNo, Attr )
ConnectionNo is the integer returned by the Server_Connect() function that identifies the database connection number.
Attr is a code indicating which information to return.
Return Value
String
Description
The Server_ConnectInfo function returns information about a database connection. The first parameter selects the connection number (starting at 1). The second parameter selects the kind of information that will be returned. Refer to the following table.
| Attr value | ID | Server_ConnectInfo() returns: |
|---|---|---|
| SRV_CONNECT_INFO_DRIVER_NAME | 1 | String result, the name identifying the toolkit drivername associated with this connection. |
| SRV_CONNECT_INFO_DB_NAME | 2 | String result, returning the type of database to which connection is made. The possible return values are:
|
| SRV_CONNECT_INFO_SQL_USER_ID | 3 | String result, returning the name of the SQL user ID. |
| SRV_CONNECT_INFO_DS_NAME | 4 | String result, returning the data source name. |
| SRV_CONNECT_INFO_QUOTE_CHAR | 5 | String result, returning the quote character. |
| SRV_CONNECT_INFO_DATABASE_NAME | 6 | String result, returning the name of the database to which connection is made. |
| SRV_CONNECT_INFO_SERVER_NAME | 7 | String result, returning the name of the server that is providing the database to which connection is made. |
Example
Dim dbname as String
Dim hdbc As Integer
hdbc = Server_Connect("ODBC", "DLG=1")
dbname=Server_ConnectInfo(hdbc, SRV_CONNECT_INFO_DB_NAME)
Print dbname
See Also:
Server_Connect() function