Keywords
There are two ways OLE DB applications can initialize data source objects:
- IDBInitialize::Initialize
- IDataInitialize::GetDataSource
In the first case, a provider string can be used to initialize connection properties by setting the property DBPROP_INIT_PROVIDERSTRING in the DBPROPSET_DBINIT property set. In the second case, an initialization string can be passed to IDataInitialize::GetDataSource method to initialize connection properties. Both methods initialize the same OLE DB connection properties, but different sets of keywords are used. The set of keywords used by IDataInitialize::GetDataSource is at minimum the description of properties within the initialization property group.
Boolean properties set in provider strings via DBPROP_INIT_PROVIDERSTRING values are set using the values "yes" and "no". Boolean properties set in initialization strings using IDataInitialize::GetDataSource are set using the values "true" and "false".
Applications using IDataInitialize::GetDataSource can also use the keywords used by IDBInitialize::Initialize but only for properties that do not have a default value. If an application uses both the IDataInitialize::GetDataSource keyword and the IDBInitialize::Initialize keyword in the initialization string, the IDataInitialize::GetDataSource keyword setting is used. It is strongly recommended that applications do not use IDBInitialize::Initialize keywords in IDataInitialize:GetDataSource connection strings, as this behavior may not be maintained in future releases.
Connection strings used by OLE DB applications using DBPROP_INIT_PROVIDERSTRING with IDBInitialize::Initialize have the following syntax:
connection-string ::= empty-string[;] | attribute[;] |
attribute; connection-string
empty-string ::=
attribute ::= attribute-keyword=[{]attribute-value[}]
attribute-value ::= character-string
attribute-keyword ::= identifier
Attribute values can optionally be enclosed in braces, and it is good practice to do so. This avoids problems when attribute values contain non-alphanumeric characters. The first closing brace in the value is assumed to terminate the value, so values cannot contain closing brace characters.
The following table describes the keywords that may be used with DBPROP_INIT_PROVIDERSTRING.
Keyword | Initialization property | Description |
---|---|---|
Addr |
SSPROP_INIT_NETWORKADDRESS |
Synonym for "Address". |
Address |
SSPROP_INIT_NETWORKADDRESS |
The network address of an instance of SQL Server in the organization. |
APP |
SSPROP_INIT_APPNAME |
The string identifying the application. |
AttachDBFileName |
SSPROP_INIT_FILENAME |
The name of the primary file (include the full path name) of an attachable database. To use AttachDBFileName, you must also specify the database name with the provider string Database keyword. If the database was previously attached, SQL Server does not reattach it (it uses the attached database as the default for the connection). |
Auto Translate |
SSPROP_INIT_AUTOTRANSLATE |
Synonym for "AutoTranslate". |
AutoTranslate |
SSPROP_INIT_AUTOTRANSLATE |
Configures OEM/ANSI character translation. Recognized values are "yes" and "no". |
Database |
DBPROP_INIT_CATALOG |
The database name. |
DataTypeCompatibility |
SSPROP_INIT_DATATYPECOMPATIBILITY |
Specifies the mode of data type handling to use. Recognized values are "0" for provider data types and "80" for SQL Server 2000 data types. |
Encrypt |
SSPROP_INIT_ENCRYPT |
Specifies whether data should be encrypted before sending it over the network. Possible values are "yes" and "no". The default value is "no". |
FailoverPartner |
SSPROP_INIT_FAILOVERPARTNER |
The name of the failover server used for database mirroring. |
FailoverPartnerSPN |
SSPROP_INIT_FAILOVERPARTNERSPN |
The SPN for the failover partner. The default value is an empty string. An empty string causes SQL Server Native Client to use the default, provider-generated SPN. |
Language |
SSPROPT_INIT_CURRENTLANGUAGE |
The SQL Server language. |
MarsConn |
SSPROP_INIT_MARSCONNECTION |
Enables or disables multiple active result sets (MARS) on the connection if the server is SQL Server 2005 or later. Possible values are "yes" and "no". The default value is "no". |
Net |
SSPROP_INIT_NETWORKLIBRARY |
Synonym for "Network". |
Network |
SSPROP_INIT_NETWORKLIBRARY |
The network library used to establish a connection to an instance of SQL Server in the organization. |
Network Library |
SSPROP_INIT_NETWORKLIBRARY |
Synonym for "Network". |
PacketSize |
SSPROP_INIT_PACKETSIZE |
Network packet size. The default is 4096. |
PersistSensitive |
DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO |
Accepts the strings "yes" and "no" as values. When "no", the data source object is not allowed to persist sensitive authentication information |
PWD |
DBPROP_AUTH_PASSWORD |
The SQL Server login password. |
Server |
DBPROP_INIT_DATASOURCE |
The name of an instance of SQL Server in the organization. When not specified, a connection is made to the default instance on the local computer. |
ServerSPN |
SSPROP_INIT_SERVERSPN |
The SPN for the server. The default value is an empty string. An empty string causes SQL Server Native Client to use the default, provider-generated SPN. |
Timeout |
DBPROP_INIT_TIMEOUT |
The amount of time (in seconds) to wait for data source initialization to complete. |
Trusted_Connection |
DBPROP_AUTH_INTEGRATED |
When "yes", instructs the SQL Server Native Client OLE DB provider to use Windows Authentication Mode for login validation. Otherwise instructs the SQL Server Native Client OLE DB provider to use a SQL Server username and password for login validation, and the UID and PWD keywords must be specified. |
TrustServerCertificate |
SSPROP_INIT_TRUST_SERVER_CERTIFICATE |
Accepts the strings "yes" and "no" as values. The default value is "no", which means that the server certificate will be validated. |
UID |
DBPROP_AUTH_USERID |
The SQL Server login name. |
UseProcForPrepare |
SSPROP_INIT_USEPROCFORPREP |
This keyword is deprecated, and its setting is ignored by the SQL Server Native Client OLE DB Provider. |
WSID |
SSPROP_INIT_WSID |
The workstation identifier. |
Connection strings used by OLE DB applications using IDataInitialize::GetDataSource have the following syntax:
connection-string ::= empty-string[;] | attribute[;] |
attribute; connection-string
empty-string ::=
attribute ::=
attribute-keyword=[quote]attribute-value[quote]
attribute-value ::= character-string
attribute-keyword ::= identifier
quote ::= " | '
Attribute values can optionally be enclosed in single or double quotes, and it is good practice to do so. This avoids problems when values contain non-alphanumeric characters. The quote character used can also appear in values, provided that it is doubled.
'Brain Trainning > PRG Language' 카테고리의 다른 글
[MSSQL] JDBC 연결 (0) | 2011.02.25 |
---|---|
[MongoDB] Comparison of data serialization formats (0) | 2011.01.18 |
MSSQL + PHP 연동 (0) | 2010.12.21 |
Programming Windows Phone 7, by Charles Petzold (0) | 2010.10.29 |
WidowsClient.Net (0) | 2010.05.12 |