SQLBrowseConnect
SQLBrowseConnect uses keywords that can be categorized into three levels of connection information. For each keyword, the following table indicates whether a list of valid values is returned and whether the keyword is optional.
Level 1
Keyword | List returned? | Optional? | Description |
---|---|---|---|
DSN |
N/A |
No |
Name of the data source returned by SQLDataSources. The DSN keyword cannot be used if the DRIVER keyword is used. |
DRIVER |
N/A |
No |
Microsoft® SQL Native Client ODBC driver name is {SQL Native Client}. The DRIVER keyword cannot be used if the DSN keyword is used. |
Level 2
Keyword | List returned? | Optional? | Description |
---|---|---|---|
SERVER |
Yes |
No |
Name of the server on the network on which the data source resides. The term "(local)" can be entered as the server, in which case a local copy of SQL Server can be used, even when this is a non-networked version. |
UID |
No |
Yes |
User login ID. |
PWD |
No |
Yes (depends on the user) |
User-specified password. |
APP |
No |
Yes |
Name of the application calling SQLBrowseConnect. |
WSID |
No |
Yes |
Workstation ID. Typically, this is the network name of the computer on which the application runs. |
Level 3
Keyword | List returned? | Optional? | Description |
---|---|---|---|
DATABASE |
Yes |
Yes |
Name of the SQL Server database. |
LANGUAGE |
Yes |
Yes |
National language used by SQL Server. |
SQLBrowseConnect ignores the values of the DATABASE and LANGUAGE keywords stored in the ODBC data source definitions. If the database or language specified in the connection string passed to SQLBrowseConnect is invalid, SQLBrowseConnect returns SQL_NEED_DATA and the level 3 connection attributes.
The following attributes, set by calling SQLSetConnectAttr, determine the result set returned by SQLBrowseConnect.
SQL_COPT_SS_BROWSE_CONNECT: If it is set to SQL_MORE_INFO_YES, in SQL Server version 7.0, SQLBrowseConnect returns a list of servers. In SQL Server 2000 and later, SQLBrowseConnect returns an extended string of server properties.
This is an example of an extended string returned by SQLBrowseConnect in SQL Server 2000:
ServerName\InstanceName;Clustered:No;Version:8.00.131
In this string, semi-colons separate various parts of information about the server, and commas separate different server instances.
SQL_COPT_SS_BROWSE_SERVER: If a server name is specified, SQLBrowseConnect will return information for the server specified. If SQL_COPT_SS_BROWSE_SERVER is set to NULL, SQLBrowseConnect returns information for all servers in the domain.
Note
Due to the nature of broadcasting on networks, SQLBrowseConnect might not receive a timely response from all servers, and therefore the list of servers returned can vary for each request.
See Also
Concepts
ODBC API Implementation Details