SAMPLE: DB2XML Implements Pluggable Protocol Handler

Article translations Article translations
Article ID: 260528
This article was previously published under Q260528
Expand all | Collapse all

On This Page

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 "ATL30" 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:
Microsoft Universal Data Access (MDAC) Web page
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 "References" section of this article.

DB2XML provides a simple CSV text file that is named "URLlist.txt" 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]
; Everything after this line is an OLE DB initstring
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.

References

For directions on creating a .udl file, refer to the Data Link API overview in the MDAC 2.5 - OLE DB Programmer's Reference. In the MSDN documentation, this article is currently located at:
Platform SDK: Data Access Services, Microsoft OLE DB, OLE DB Programmer's Reference, Part 2 OLE DB Core, Chapter 20: OLE DB Core Components, Connection Strings and Data Links, Data Link API Overview

The OLE DB templates that are provided with Visual C++ 6 are currently documented at:
Visual Studio 6.0 Documentation: Visual C++ Documentation, Reference, Microsoft Foundation Class Library and Templates, OLE DB Templates

Properties

Article ID: 260528 - Last Review: May 22, 2013 - Revision: 6.0
Keywords: 
kbdownload kbfile kbsample kburlmon KB260528
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com