Use the SQL IIS virtual Directory Management utility

Source: Internet
Author: User
Tags microsoft sql server xpath

Before you use HTTP to access a Microsoft SQL Server 2000 database, you must install the appropriate virtual directory. On a computer running Microsoft Internet Information Services (IIS), define and note using the IIS virtual Directory Management utility for SQL Server (click Configure SQL XML support in IIS in the SQL Server Tools program group) A new virtual directory, known as the virtual root. This utility instructs IIS to create an association between a new virtual directory and a Microsoft SQL Server instance. For information about the utility user interface, see the IIS Virtual Directory Management utility.

The name of the IIS server and virtual directory must be specified as part of the URL. The information in the virtual directory, including logins, passwords, and access rights, is used to establish a connection to a specific database and execute the query.

You can specify a URL:

Direct access to database objects, such as tables.

In this case, the URL will include the virtual name of the DBObject type.

Executes the template file.

A template is a valid XML document that consists of one or more SQL statements. When you specify a template file in a URL, the SQL commands stored in the template file are executed. You can specify SQL queries directly in the URL, but this is not recommended, given security.

Executes an XPath query.

Performs an XPath query on a annotated mapped schema file that specifies as part of the URL.

Virtual name to make a template file, a mapped schema file, or a database object (such as a table or view) part of a URL, you must create a virtual name for the template, schema, and dbobject types. Specifies the virtual name as part of the URL to execute the template file, perform an XPath query on the mapped schema file, or access the database directly.

The virtual name type (template, schema, dbobject) specified in the URL is also used to determine the type of file (template file or mapping schema file) that is specified in the URL. For example

The following URL uses a template to access the SQL Server database:

Http://IISServer/nwind/TemplateVirtualName/Template.xml

Templatevirtualname is the template type of virtual name that identifies the specified file (template.xml) as the template file.

Create a nwind virtual directory

New information-SQL Server SP3.

The following example creates a nwind virtual directory. In most of the instructions for Microsoft? SQL Server? 2000 of the URL access examples, all use the nwind virtual directory.

Before you create a nwind virtual directory, you need a physical directory associated with the virtual directory that you will create (for example, C:\Inetpub\Wwwroot\nwind, where nwind is the physical directory associated with the NWIND virtual directory that will be created in the following procedure).

You also need to create two subdirectories under the physical directory associated with the virtual directory (for example, C:\Inetpub\Wwwroot\nwind\template and

C:\Inetpub\Wwwroot\nwind\schema). These are the directories associated with the virtual names of the template and schema types, both of which are created as part of the creation of the nwind virtual directory.

Create a nwind virtual directory

In the Microsoft SQL Server program group, click Configure SQL XML support in IIS.

Expand the server, and then click the Web site you want.

On the Action menu, point to the New submenu, and then click Virtual Directory. The property page for the new virtual directory appears on the screen.

On the General tab of the new Virtual Directory Properties dialog box, enter the name of the virtual directory. For this example, type the nwind and physical directory path (for example, C:\Inetpub\Wwwroot\nwind, assuming the nwind subdirectory has been created in the C:\Inetpub\Wwwroot directory). Alternatively, you can use the Browse button to select the directory.

On the Security tab, select SQL Server and use Windows integrated authentication.

On the Data Sources tab, enter the name of the server in the SQL Server box, such as (local), or, if more than one instance is installed on the specified computer, enter the name of the SQL Server2000 instance (optional). In the Database box, enter the name of Northwind as the default database.

On the Settings tab, select the Allow URL query, allow template query, allow XPath, and allow POST options.

On the Virtual Name tab, click the New button to create a virtual name for the template type.

In the Virtual Name Configuration dialog box, enter template in the Virtual name box (which can be any user-specified name). In the Type list, select Templates. The input path (for example, C:\Inetpub\Wwwroot\nwind\template, assumes a subdirectory template under the physical directory associated with the virtual directory, but does not check that the directory exists). Click the Save button to save the virtual name.

On the Virtual Name tab, click the New button to create a virtual name for the schema type.

Enter a schema in the Virtual name box (can be any user-specified name). In the Type list, select Schema. The input path (for example, C:\Inetpub\Wwwroot\nwind\schema, assumes a subdirectory schema under the physical directory associated with the virtual directory). Click the Save button to save the virtual name.

On the Virtual Name tab, click the New button to create a virtual name for the template and schema type.

Enter DBObject in the Virtual Name box (which can be any user-specified name). In the Type list, select DBObject. Click the Save button to save the virtual name. , click the OK button to save the settings.

This creates the virtual directory nwind. By default, the specified query is executed against the Northwind database using this virtual directory.

To test the virtual directory, in the browser, type:

/nwind?sql=SELECT">http://<IISServer>/nwind?sql=SELECT * FROM Employees FOR XML AUTO&root=rootand press the ENTER key.

accessing SQL Server using HTTP

New information-SQL Server SP3.

Can I use HTTP to access Microsoft? SQL Server? 2000. For more information about the URL syntax supported by the SQL ISAPI extension, see URL Access. Before you can specify queries using HTTP, you must first create a virtual root with the IIS virtual Directory Management utility for SQL Server. For more information, see Creating nwind virtual directories.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.