Requirements
This article assumes that you are familiar with the following topics:- Data access by using RDS
- Programming by using Microsoft Visual Basic 6.0
- Microsoft Visual Basic 6.0
- Microsoft Windows Server 2003
Configure RDS
This section describes the configuration steps that you must use to configure RDS on a computer that is running Microsoft Windows Server 2003.Create a Virtual Directory
- Click Start, click Run, type inetmgr, and then click OK. The Internet Information Services (IIS) Manager window appears.
- In the left pane, locate, and then right-click the Default Web Site node.
- Point to New, and then click Virtual Directory. The Virtual Directory Creation Wizard wizard appears.
- Click Next.
- Type MSADC in the Alias box, and then click Next.
- Type System Drive
Letter:\Program Files\Common Files\System\msadc in
the Path box.
Note System Drive Letter is the placeholder for the letter that is assigned to your system drive where the operating system is installed. - Click Next.
- If the following check boxes are not selected, click to select them:
- Read
- Run scripts (such as ASP)
- Execute (such as ISAPI application or CGI)
- Click Next.
- Click Finish.
Add a Web service extension
- In the left pane of the Internet Information Services (IIS) Manager window, locate, and then right-click Web Service Extensions.
- Click Add a new Web Service Extension. The New Web Service Extension dialog box appears.
- Type RDS in the Extension name box, and then click Add. The Add file dialog box appears.
- Type System Drive
Letter:\Program Files\Common
Files\System\msadc\msadcs.dll in the Path to file
box, and then click OK.
Note System Drive Letter is the placeholder for the letter that is assigned to your system drive where the operating system is installed. - Click OK.
- To enable the extension, click Allow. By default, all the newly created extensions are prohibited.
Create keys in the registry
Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.Note If the following registry keys are already present in the registry database, do not create them again.
- Click Start, click Run, type regedit, and then click OK.
- In the left pane of Registry Editor, locate, and then
right-click the following subkey:HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W3SVC\Parameters\ADCLaunch
- Click New, and then click Key. A new subkey is created under the ADCLaunch subkey.
- Rename the subkey that you created in step 3 of the "Create keys in registry" section AdvancedDataFactory.
- Repeat step 3 and step 4 of the "Create keys in registry" section to create another subkey under the subkey ADCLaunch.
- Rename the subkey that you created after step 6 of the "Create keys in registry" section RDSServer.DataFactory.
Run the Web server in an unsafe mode
Warning This workaround may make your computer or your network more vulnerable to attack by malicious users or by malicious software such as viruses. We do not recommend this workaround but are providing this information so that you can choose to implement this workaround at your own discretion. Use this workaround at your own risk.To use RDS, you must run the Microsoft Internet Information Services (IIS) server in an unsafe mode. To make the IIS server run in an unsafe mode, you must run the Handunsf.reg file that is installed together with the Microsoft Data Access Components (MDAC) Redist Setup Program. However, this file has been removed from MDAC 2.8. By default, MDAC 2.8 is installed together with Microsoft Windows Server 2003. Therefore, the Handunsf.reg file is not available on a computer that is running Microsoft Windows Server 2003.
Therefore, to make the IIS server run in an unsafe mode, administrators of the computer where IIS service is running can use msdfmap.handler in the code and edit the msdfmap.ini file to make the appropriate changes in the msdfmap.ini file so that the application can access the data by using RDS. For additional information about removal of the Handunsf.reg file from MDAC 2.8, click the following article number to view the article in the Microsoft Knowledge Base:
818490
Handunsf.reg file has been
removed in MDAC 2.8 Redist Setup for security reasons
Verify the RDS configuration
Verification of the RDS configuration is a three-step process. First, you must edit the msdfmap.ini file on the computer that is running Internet Information Service (IIS). Second, you must create a system Data Source Name (DSN) on the computer that is running Internet Information Services (IIS). Third, you must create a standard EXE project in Microsoft Visual Basic 6.0, and verify the functionality of RDS. If RDS is configured correctly on your computer, follow these steps to receive the data from your Microsoft SQL Server server without any error.- Create a system DSN.
For additional information about how to create a
system DSN, click the following article number to view the article in the Microsoft Knowledge Base:
300596 How to create a System Data Source Name (DSN) in Windows 2000Note This steps in this article that describe how to create a system DSN on a computer that is running Microsoft Windows 2000 can also be used to create a system DSN on a computer that is running Microsoft Windows Server 2003.
- Edit the msdfmap.ini file.
- Locate the file msdfmap.ini in the System
Drive Letter:\Windows folder on your computer.
Note System Drive Letter is the placeholder for the letter that is assigned to your system drive where the operating system is installed. - Open the msdfmap.ini file in notepad, and paste the
following code at the end of the file:Note MyDSNName is a placeholder for the DSN that you created in step 1, MyUserID is a placeholder for the userid of the user account that has access to your SQL Server server, and MyPassword is a placeholder for the password of the user account.
[connect MyAuthorDatabase] Access=ReadWrite Connect="DSN=MyDSNName;UID=MyUserID;PWD=MyPassword" [userlist MyAuthorDatabase] Administrator=ReadWrite [sql MyAuthorById] Sql="SELECT * FROM Authors"
- Save the file.
- Locate the file msdfmap.ini in the System
Drive Letter:\Windows folder on your computer.
- Create a standard EXE project in Microsoft Visual Basic
6.0.
- Start Microsoft Visual Basic 6.0.
- Create a Standard EXE project. By default, a form that is named Form1 is created.
- In the Project Explorer window, right-click Form1, and then click View Code.
- Paste the following code in the code window of the
Form1 form:
Private Sub Form_Load() ' On Error GoTo ErrorHandler Dim dc As RDS.DataControl Dim rst As ADODB.Recordset ' Set dc = New RDS.DataControl dc.Handler = "MSDFMAP.Handler" dc.Server = "http://localhost" dc.ExecuteOptions = 1 dc.FetchOptions = 1 dc.Connect = "Data Source=MyAuthorDatabase" dc.SQL = "MyAuthorById" ' Wait at least 20 seconds dc.InternetTimeout = 200 dc.Refresh Set rst = dc.Recordset ' Do While Not rst.EOF Debug.Print rst!au_fname & " " & rst!au_lname rst.MoveNext Loop ' If rst.State = adStateOpen Then rst.Close Set rst = Nothing Set dc = Nothing Exit Sub ErrorHandler: ' clean up If Not rst Is Nothing Then If rst.State = adStateOpen Then rst.Close End If Set rst = Nothing Set dc = Nothing If Err <> 0 Then MsgBox Err.Source & "-->" & Err.Description, , "Error" End If ' End Sub
- On the Run menu, click Start With Full Compile.