Microsoft KB Archive/260528

= SAMPLE: DB2XML Implements Pluggable Protocol Handler =

Article ID: 260528

Article Last Modified on 8/9/2004

-

APPLIES TO


 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q260528



SUMMARY
DB2XML is a sample pluggable protocol handler for Internet Explorer. It provides a protocol-based mechanism for extracting XML data from a database table through the use of an SQL-style query.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

DB2XML.exe

Release Date: Feb-01-2001

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. To use the DB2XML protocol, simply use a URL of the following format anywhere that a URL is used to return XML data: x-db2xml://udl=|{URL to UDL file}|sql=|{SQL select statement}| where {URL to UDL file} is an absolute URL that references the location of a UDL file that identifies the database data source and {SQL select statement} is an ordinary SQL SELECT statement for querying a database.

You can use the HTML file Prottest-urllist.htm, which is included with the project, to view an actual example of the proper URL syntax for the urllist CSV text file database, as described later in this article.

Building the Project
The current Platform SDK headers and libraries are required to build this sample in Visual C++ 6.0. You must ensure that the Platform SDK include and libraries folder have been added to the default include and libraries directory lists in Microsoft Visual C++. To do so, you can choose Options from the Tools menu, and then click the Directories tab.

Because of incompatibilities in the Active Template Library (ATL) that were included in Visual C++ 6.0 with the new Platform SDK headers, the new Platform SDK &quot;ATL30&quot; subfolder must be first in the list.

After a successful build in Visual C++, the protocol will be self-registered and ready to use.

Simple Test
To test the pluggable protocol portion of DB2XML without connecting to a database, you can type the following URL into Internet Explorer's address bar:

x-db2xml://*test*

This outputs simple XML test data from the protocol handler.

To exercise the full use of DB2XML and retrieve data from a database, Windows 2000, or MDAC 2.5 or later is required on the client computer. Also, a .udl file must be set up for access to a database.

Installing MDAC
Make sure that the latest Microsoft Data Access Components (MDAC) components have been installed on all client computers. These can be downloaded from the following Microsoft Web site:

http://msdn.microsoft.com/dataaccess

This sample was tested against MDAC 2.5.

Setting Up the .udl File
The DB2XML protocol requires a Microsoft Data Link File (.udl extension) to specify the connection string for a database. For full instructions and documentation on Data Link Files and the OLE DB Data Link technology, see the &quot;References&quot; section of this article.

DB2XML provides a simple CSV text file that is named &quot;URLlist.txt&quot; and an associated URLlist.udl file, which you can use to test the protocol through the ODBC text driver. Simply correct the path to the Initial Catalog in the UDL file to the directory where URList.txt currently resides. For example, URLlist.udl: [oledb] DefaultDir=.;Driver= ... Initial Catalog=C:\temp\db2xml !! <-- correct this path to point to the directory where urllist.txt resides You can run more complicated tests against other databases by creating new .udl files and DSNs through the Data Link Properties dialog box. As described in the Data Link documentation, this is as simple as creating a new empty text file, renaming the file to Yourudlfilename.udl, and opening the new .udl file. The Data Link Properties dialog box will help you to create a connection string for any installed data provider driver.
 * Everything after this line is an OLE DB initstring

