Sdílet prostřednictvím


Introduction to the SQLXMLOLEDB Provider (SQLXML 4.0)

The SQLXMLOLEDB Provider is an OLE DB provider that exposes Microsoft SQLXML functionality through ActiveX Data Objects (ADO). However, the provider can execute commands only in the "write to an output stream" mode of ADO. The SQLXMLOLEDB Provider is not a rowset provider. When you execute a command, you must specify the adExecuteStream flag, which directs ADO to use the output stream that you have specified. 

The following example shows the syntax for the Execute command in which the adExecuteStream flag is specified:

Dim oTestCommand As New ADODB.Command
...
oTestCommand.Properties("Output Stream").Value = oTestStream
oTestCommand.Execute , , adExecuteStream
...

SQLXMLOLEDB Provider-specific Properties

The SQLXMLOLEDB Provider exposes the following provider-specific connection property.

Connection

property

Default

(if any)

Description

Data Provider

 

Provides the PROGID of the OLE DB provider through which SQLXMLOLEDB executes the commands. Beginning in SQLXML 4.0 and SQL Server 2005, this provider is contained within the SQL Server Native Client; therefore, this property value is restricted to "SQLNCLI10". For more information, see SQL Server 2008 R2 Native Client Programming.

The SQLXMLOLEDB Provider exposes the following provider-specific command properties.

Command

property

Default

(if any)

Description

Base Path

""

Specifies the base file path. The base file path is used to specify the location of the XML Stylesheet Language (XSL) or mapping schema files. The base file path is also used to resolve the relative paths of XSL or mapping schema files that have been specified in the XSL or Mapping Schema properties.

For an example in which this property is used, see Executing XPath Queries (SQLXMLOLEDB Provider).

ClientSideXML

False

Set this property to True if you want the process of converting the rowset to XML to occur on the client instead of on the server. This is useful when you want to move the performance load to the middle tier.

For an example in which this property is used, see Executing SQL Queries (SQLXMLOLEDB Provider) or Executing Templates That Contain SQL Queries (SQLXMLOLEDB Provider).

Content Type

 

Returns the output content type. This is a READ ONLY property.

This property provides information to the browser about the content type (such as TEXT/XML, TEXT/HTML, image/jpeg, and so on). The value of this property becomes the content-type field that is sent to the browser as part of the HTTP header, which contains the MIME-type (Multipurpose Internet Mail Extensions) of the document being sent as the body.

Mapping Schema

NULL

If a client application executes an XPath query against a mapping schema (XDR or XSD), this property is used to specify the name of the mapping schema.

The path that is specified can be relative (xyz/abc/MySchema.xml) or absolute (C:\MyFolder\abc\MySchema.xml).

If a relative path is specified, the base path that is specified by the Base Path property is used to resolve the relative path. If no path has been specified in the Base Path property, the relative path is relative to the current directory.

In specifying a value for the Mapping Schema property, you can specify a local directory path or a URL (http://...). If you specify a URL, you must configure WinHTTP to access HTTP and HTTPS servers through a proxy server. You can do this by executing the Proxycfg.exe utility. For more information, see "Using the WinHTTP Proxy Configuration Utility" in the MSDN Library.

For an example in which this property is used, see Executing XPath Queries (SQLXMLOLEDB Provider).

namespaces

 

This property enables the execution of XPath queries that use namespaces. For an example in which this property is used, see Executing XPath Queries with Namespaces (SQLXMLOLEDB Provider).

ss Stream Flags

 

This property is used to specify particular types of security restrictions. For example, you might not want to allow URL references to files or absolute paths to files (such as external sites). Or you might not want to allow queries in the templates.

The property can be assigned these values:

1 = STREAM_FLAGS_DISALLOW_URL 2 = STREAM_FLAGS_DISALLOW_ABSOLUTE_PATH 4 = STREAM_FLAGS_DISALLOW_QUERY 8 = STREAM_FLAGS_       DONTCACHEMAPPINGSCHEMA 16 = STREAM_FLAGS_DONTCACHETEMPLATE 32 = STREAM_FLAGS_DONTCACHEXSL

Additional information about these values is provided in the next table.

xml root

 

This property is used to define a root tag for the resulting XML. For example, if you execute SQL queries against the database and the resulting XML document has no single root element, the value of the property is used to add a single root element to the document.

For an example in which this property is used, see Executing SQL Queries (SQLXMLOLEDB Provider).

xsl

 

This property is used to specify the XSL file name when you want to apply XSL transformation to the XML document returned by the query.

The path that is specified can be relative (xyz/abc/MyXSL.xsl) or absolute (C:\MyFolder\abc\MyXSL.xsl).

If a relative path is specified, the base path that is specified by the Base Path property is used to resolve the relative path. If no path has been specified in the Base Path property, the relative path is relative to the current directory.

For an example in which this property is used, see Applying an XSL Transformation (SQLXMLOLEDB Provider).

The following table contains descriptions of the ss Stream Flags property values.

Property value

Description

STREAM_FLAGS_DISALLOW_URL

URLs are not accepted for mapping schemas or XSL.

STREAM_FLAGS_DISALLOW_ABSOLTE_PATH

A path that is specified for a mapping schema or for XSL must be relative to the base path of the template itself.

STREAM_FLAGS_DISALLOW_QUERY

Queries are not allowed in a template.

STREAM_FLAGS_DONTCACHEMAPPINGSCHEMA

The mapping schema is not cached. This property value is useful during the database development phase, when database schemas are subject to alteration.

STREAM_FLAGS_DONTCACHETEMPLATE

Templates are not cached.

STREAM_FLAGS_DONTCACHEXSL

XSL is not cached.