📄 readme.htm.base
字号:
<HTML>
<head>
<title>IMDB Sample 1</title>
<link rel="stylesheet" href="../styles.css" type="text/css">
<style>
A:link {color: Olive}
A:visited {color: 336666}
A:hover {background:Olive; color: White}
</style>
</head>
<BODY>
<H2>IMDB Sample 1</H2>
<P><A HREF="#Overview">Overview</A><BR>
<A HREF="#ProjectFiles">Project Files</A><BR>
<A HREF="#BuildNotes">Build Notes</A><BR>
<A HREF="#Remarks">Remarks</A><BR>
<A HREF="#SetupandConfigurationIssues">Setup and Configuration Issues</A><BR>
<A HREF="#CodeTour">Code Tour</A></P>
<P><HR></P>
<P><A NAME="Overview"></P>
<H3>Overview</H3>
<P>The IMDBSamp1 sample demonstrates how an active server page (.asp) running in Microsoft Internet Information Services (IIS) can read data from the Microsoft In-Memory Database (IMDB) and return it to an HTML client, like Microsoft Internet Explorer. The IMDBSamp1 sample initially guides you through the process of setting up and configuring an IMDB installation, and running a simple client application to access data loaded into IMDB. </P>
<P>An active server page with embedded VBScript is the data access method in the IMDBSamp1 sample. Database operations are performed using Microsoft ActiveX Data Objects (ADO), a powerful, yet easy-to-use data access application programmer interface. ADO is built on an OLE Database (OLE DB) foundation, and can be used from many development environments, including active server pages with VBScript, Visual Basic, Java, and C++. For more information on ADO and OLE DB, see the <A HREF="http://www.microsoft.com/data/">Microsoft Universal Data Access Website</A>. </P>
<P><B>Note</B> Active server pages that access IMDB directly through IIS can only read data from IMDB without any additional security configuration; updates to IMDB or a back-end database are possible using a database userid and password that is specified in the connection string of the IMDB data source name. For more information, see the <A HREF="#Remarks">Remarks</A> section. </P>
<P>When you use ADO to access IMDB, there are some specific techniques you must follow. These techniques are covered in detail in the <A HREF="#CodeTour">Code Tour</A> section of the IMDBSamp1 sample. </P>
<P>If you do not have Windows NT 5.0, COM+, or other necessary components installed to run this sample, please see the <A HREF="#SetupandConfigurationIssues">Setup and Configuration Issues</A>. </P>
<P>When you successfully run the IMDB sample, you have completed many basic and necessary tasks required to use IMDB, regardless of access method and specific components. You have: </P>
<UL>
<LI>installed COM+, SQL Server, IIS, and other components successfully. </LI>
<LI>configured IMDB successfully to load tables through the Microsoft OLE DB Provider for ODBC (MSDASQL) from SQL Server </LI>
<LI>configured an ODBC System DSN successfully to access a SQL Server installation </LI>
<LI>used an ADO code sample that does all basic operations on data retrieved from IMDB -- Read, Sort, and Filter. </LI>
<LI>examined ADO code that uses techniques specific to programming to IMDB. </LI></UL>
<P><A NAME="ProjectFiles"></P>
<H3>Project Files</H3>
<TABLE>
<TR><TD>
<P><STRONG>File</STRONG></TD>
<TD>
<STRONG><P>Description</STRONG></TD>
</TR>
<TR><TD>
<P>IMDBSamp1A.asp</TD>
<TD>
<P>The initial page you launch the sample from, which accesses an .asp page in Internet Information Services.</TD>
</TR>
<TR><TD>
<P>IMDBSamp1B.asp</TD>
<TD>
<P>An active server page that accesses IMDB directly and reads a recordset. This is a VBScript demonstration using ADO.</TD>
</TR>
</TABLE>
<P><A NAME="BuildNotes">
<H3>Build Notes</H3>
<P>You do not need to build or compile any files to run this sample. Simply copy the IMDBSamp1A.asp and IMDBSamp1B.asp files into the \wwwroot directory of you Internet Information Services installation, and open IMDBSamp1A.asp with Internet Explorer using a fully qualified URL.
<P>If the sample does not run, make sure you have installed all the necessary components and have configured IMDB, SQL Server, and ODBC correctly.
<A NAME="Remarks">
<H3>Remarks</H3>
<P>This sample demonstrates how to read data from IMDB with active server pages using IIS, the simplest possible scenario in which you can use IMDB. When you use IIS with trusted connections, COM+ role-based security checks are by-passed and you are only able to perform reads from IMDB; updates to IMDB return an error. However, you can perform updates using a database password and userid that you specify on the connection string (which is what we do in this sample). For more information, see <B>Using ADO Connection Strings with IMDB</B> and related topics in the COM+ Programmer's Guide (Writing Components for COM+ Applications).
<P>In the IMDBSamp2 sample (not included in this release), you will see active server pages and IIS in action again. In the IMDBSamp2 sample, however, a middle-tier COM+ business component is instantiated from an active server page, and will use trusted connections rather than a user-supplied database userid and password.
<A NAME="SetupandConfigurationIssues">
<H3>Setup and Configuration Issues</H3>
<P>This sample is designed to mimic a typical business scenario where IMDB might be used, namely a multi-node network. You can run this sample in any environment, of course, but to keep things as simple as possible, the environment described here is encapsulated on one physical machine.
<P>During the first phase of the sample (<A HREF="#IMDBSAMPp1">Installation</A>), you will install and configure the necessary components required to run an HTML client that reads an ADO Recordset from a table loaded in IMDB from SQL Server. The installations are default installations, and initially require no extra configuration. The components include Microsoft COM+, Internet Information Services, and SQL Server. These components can be installed on any Windows NT 5.0 system, and do not require a network connection for the sample to run correctly.
<P>During the second phase of the sample (<A HREF="#IMDBSAMPp2">Configuration</A>), you will configure the various installed components to work together, including IMDB, SQL Server, and ODBC. You will learn some of the data access terminology related to the ActiveX Data Objects, OLE DB, and IMDB, and learn about OLE DB providers. Please note that if the service is running, all configuration changes are ignored until you stop and start the service again. Additionally, if you change user/group assignment with the Windows NT User Manager, you may have to reboot the system.
<P>The final phase of the sample is to run the sample and manipulate the data retrieved from IMDB using sort and filter operations.
<B><P>Note </B>If some of these components are already installed on your system (for example if you already have IIS or SQL Server installed), you can skip the step.
<TABLE CELLSPACING=0 BORDER=0 CELLPADDING=5 WIDTH=624>
<TR><TD WIDTH="98%" VALIGN="TOP">
<OL>
<LI><A HREF="#IMDBSAMPp1">Phase 1: Installation</A> </LI>
<OL>
<LI><A HREF="#IMDBSAMP1A">Install Microsoft Windows NT 5.0</A> </LI>
<LI><A HREF="#IMDBSAMP1B">Install COM+</A> </LI>
<LI><A HREF="#IMDBSAMP1C">Install Microsoft Internet Information Services</A> </LI>
<LI><A HREF="#IMDBSAMP1D">Install Microsoft SQL Server</A> </LI>
<LI><A HREF="#IMDBSAMP1E">Install Microsoft Internet Explorer</A> </LI></OL>
<LI><A HREF="#IMDBSAMPp2">Phase 2: Configuration</A> </LI>
<OL>
<LI><A HREF="#IMDBSAMP1F">Configure IMDB to run on your system</A> </LI>
<LI><A HREF="#IMDBSAMP1G">Set up user accounts</A> </LI>
<LI><A HREF="#IMDBSAMP1H">Define a new data source</A> </LI>
<LI><A HREF="#IMDBSAMP1I">Add a specific table</A> </LI>
<LI><A HREF="#IMDBSAMP1J">Configure an ODBC System DSN</A> </LI>
<LI><A HREF="#IMDBSAMP1K">Restart the IMDB Service</A> </LI></OL>
<LI><A HREF="#IMDBSAMPp3">Phase 3: Sample Execution</A> </LI>
<OL>
<LI><A HREF="#IMDBSAMP1L">Run the sample</A> </OL>
</OL>
</TD>
<TD WIDTH="2%" VALIGN="MIDDLE">
<P><IMG SRC="..\Images\IMDBDemo1.gif" WIDTH=145 HEIGHT=336></TD>
</TR>
</TABLE>
<P><A NAME="IMDBSAMPp1">
<H4>Phase 1: Installation</H4>
<P>After you complete these steps, all the components will be in place to run IMDB samples. You will have IMDB installed on the Microsoft Windows NT operating system, and a database installed from which IMDB can load data. Internet Information Services hosts the active server pages that this and other IMDB samples use to demonstrate simple, web-based data access to IMDB. Finally, Internet Explorer is a full-featured web client that acts as the user interface to the data. <A NAME="IMDBSAMP1A">
<H4>1. Install Microsoft Windows NT 5.0</H4>
<P>Microsoft Windows NT 5.0 is required to run COM+. If you do not have Microsoft Windows NT 5.0, you must install it or upgrade your existing system before you can run the Microsoft In-Memory Database samples. <A NAME="IMDBSAMP1B">
<H4>2. Install COM+</H4>
<P>IMDB is a COM+ Service that is installed with COM+. If you have not installed COM+, you must install it before you can run the Microsoft In-Memory Database samples. <!-- If COM+ is already installed, but IMDB is not present on your system, you must re-install COM+ and make sure the IMDB installation option is enabled --><A NAME="IMDBSAMP1C">
<H4>3. Install Microsoft Internet Information Services</H4>
<P>If you already have Microsoft Internet Information Services installed, you can skip this step.
<P>Microsoft Internet Information Services is required to run this and other IMDB samples. Internet Information Services is an easy to use web server for Windows NT that can host active server pages (.asp) technology. Some of the IMDB samples use active server pages and Microsoft Internet Explorer to demonstrate how typical web-based clients might access data stored in IMDB.
<P>A default installation of Internet Information Services is all that is initially required to host an active server page and access IMDB. <A NAME="IMDBSAMP1D">
<H4>4. Install Microsoft SQL Server</H4>
<P>You can skip this step if you already have Microsoft SQL Server installed, either locally or remotely.
<P>Microsoft SQL Server is a scalable, high-performance database management system for Windows NT-based systems. In a typical business scenario, IMDB loads data from a persisted back-end database such as Microsoft SQL Server or Oracle databases, and client components access IMDB instead of directly querying the database.
<P>When you run this and other IMDB samples, the IMDB that you installed on your system <A HREF="#IMDBSAMP1B">previously</A> loads tables from SQL Server (or another database product). Defining which tables to load and configuring both IMDB and SQL Server are covered in detail later.
<P>A default installation of SQL Server is all that is initially required for the IMDB samples. <A NAME="IMDBSAMP1E">
<H4>5. Install Microsoft Internet Explorer 4.0</H4>
<P>If you already have Microsoft Internet Explorer installed, you can skip this step.
<P>Microsoft Internet Explorer 4.0 (or greater) is required to run this and other IMDB samples. It is used to access active server pages that, in turn, retrieve data from IMDB and pass the data back to Internet Explorer. Other web clients can be used if they support VBScript and active server pages. <A NAME="IMDBSAMPp2">
<H4>Phase 2: Configuration</H4>
<P>After you complete these steps, all the components that you installed during <A HREF="#IMDBSAMPp1">Phase 1: Installation</A> will be configured properly to run this and other IMDB samples. You will be able to set up the Microsoft Windows NT user account that is required to run the IMDB system service in a secure way. You will be able to specify a new data source and tables from which to load data into IMDB. And finally, you will be able to configure ODBC so that IMDB can use the Microsoft OLE DB Provider for ODBC to load and access data stored in SQL Server. <A NAME="IMDBSAMP1F">
<H4>1. Initial IMDB Configuration</H4>
<P>Once all the various components, including COM+ and IMDB, are installed on your system, you can begin configuring them.
<P>Start the Component Services Explorer, open the <B>Computers</B> folder in the console tree, and right-click on <B>My Computer</B>. Select <B>Properties</B>, click the <B>Options</B> tab, and then select the <B>IMDB Enabled</B> check box. Specify the size of your IMDB (or leave it empty and a default size will be computed for you). For now, you can use the default <B>Cached BLOB Size</B>, and disable <B>Load Tables Dynamically</B>. For more information, see Initial IMDB Configuration in the Component Services Explorer online help. <A NAME="IMDBSAMP1G">
<H4>2. Setting Up a User Account</H4>
<P>You need to set up a Windows NT user account for the IMDB system service. You can do this if you have administrative privileges on your local machine.
<P>Setting an account up for the IMDB Service is something that you usually have to do only once (or very infrequently). Setting up this account is different from setting up an account for a COM+ component that accesses IMDB (for more information, see the IMDB Configuration information in the COM+ Administrator's Guide).
<OL>
<LI>In Administrative Tools, select Computer Management. </LI>
<LI>Select System Tools and open the Local User Manager folder. </LI>
<LI>Create a new user account by right-clicking the Users folder and selecting the Create User menu option. </LI>
<LI>Name the account appropriately, and de-select the "User must change password" checkbox. </LI>
<LI>Once the account is created, close the User Manager. </LI>
<LI>You must now associate the account you created with the local IMDB system service. In the console tree of the Computer Management console, open <B>Services</B>. </LI>
<LI>Scroll down to IMDB Server (it should be currently disabled). </LI>
<LI>Right-click on the IMDB Server, and select <B>Properties</B> to view the system service properties (see figure 2.1). </LI>
<LI>Select the <B>Log On</B> tab, and press the Choose User button to associate the system service with the account you set up in the previous steps. </LI></OL>
<B><P>Note</B> Once you have associated a user account with the service, configure the service to start automatically system startup.
<P>For more information, see Setting Up a User Account for IMDB in the Component Services Explorer online help. <A NAME="IMDBSAMP1H">
<H4>3. Defining a New Data Source from which to Load Tables</H4>
<P>Using the Component Services Explorer, you can define the data source from which IMDB loads tables. Click the <B>IMDB Data Sources</B> folder under <B>My Computer</B>, and select New | Data Source from the Action menu.
<P>When you define a new data source, the values that you enter into the various fields of the <B>New IMDB Data Source</B> dialog box depend on which OLE DB provider you plan to use between IMDB and the back-end database (SQL Server, for example). We will use the Microsoft OLE DB Provider for ODBC (MSDASQL) in this and other samples. For more information on the possible choices, see <B>Which OLE DB Provider to Use</B> in the IMDB documentation in the Platform SDK.
<UL>
<LI>Specify a name for the data source entry in the <B>Name</B> field; you can use "IMDB_DS1" or something similar. </LI>
<LI>In the <B>OLE DB provider name</B> field, enter "MSDASQL". </LI>
<LI>In the <B>Provider Data Source</B> field, enter "IMDBSample1" (see <A HREF="#IMDBSAMP1J">Configure ODBC System DSN</A>). </LI>
<LI>In the <B>Provider Database</B> field, enter "pubs". This is the database in SQL Server from which IMDB will load tables. </LI>
<LI>Finally, in the <B>Provider properties</B> field, enter "uid=sa;pwd=". For more information on this field, see <B>Defining a New Data Source from which to Load Tables</B> in the IMDB Configuration section of the COM+ Administrator's Guide.</LI>
</UL>
<P>For more information, see Defining a New Data Source from which to Load Tables in the Component Services Explorer online help. <A NAME="IMDBSAMP1I">
<H4>4. Adding a Specific Table</H4>
<P>Once you have specified the data source, a data source appears in the <B>IMDB Data Source</B> folder. This data source has an associated <B>Tables</B> folder. Right click on the <B>Tables</B> folder and select Create New to specify a specific table to load into IMDB at system startup. Enter the name of the table you want to load. For the sample, enter "employee". Leave the <B>BLOB Data</B> checkbox disabled. Load the "authors" table in the same way. <A NAME="IMDBSAMP1J">
<H4>5. Configure ODBC System DSN</H4>
<P>You must now create an ODBC System DSN to allow IMDB to access SQL Server. ODBC configuration is a necessary step if you use the Microsoft OLE DB Provider for ODBC (MSDASQL). You could use other OLE DB providers, such as the Microsoft OLE DB Provider for SQL Server (SQLOLEDB), but the <A HREF="#IMDBSAMP1H">configuration of the IMDB data source</A> is different for each different provider you use.
<P>Open the Windows NT <B>Control Panel</B>, and select <B>ODBC</B>. The ODBC Data Source Administrator is started. To define a new system data source name (DSN), select the <B>System DSN</B> tab and click the <B>Add</B> button.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -