Requirements
The following items describe the recommended hardware, software, network infrastructure, skills and knowledge, and service packs you will need:- MDAC 2.5 or later as well as any one of the following operating systems:Microsoft Windows 95, Windows 98, Windows NT 4.0, or Windows 2000NOTE: MDAC Data Links drivers are available after you have installed Microsoft Visual Basic 6.0, Microsoft Data Access SDK 2.x, or Microsoft Data Access Components (MDAC) 2.x run-time components. MDAC 2.5 is installed by default with Windows 2000. You can access Data Links from the Visual Basic 6.0 Data Environment or from the Microsoft Windows 95, Windows 98, Windows NT 4.0, or Windows 2000 shell, as outlined in the following steps.
- Familiarity with Data Access Technology and Syntax (ADO)
How to Create a Data Link File
- Right-click anywhere on the Windows 2000 desktop, point to New, and then click text document. A new file is created by default (New Text Document.txt).
- Right-click the new text document that you just created and select rename, and then change the name and extension of the file to DataLink.udl and press ENTER.
If you do not see the file extension, open Windows Explorer. From the Tools menu, click Folder Options. On the View tab, clear the hide file types for known file types checkbox, and then click OK.NOTES:- A warning might appear, explaining that changing file extensions could cause files to become unusable. Disregard this warning and click OK.
- You can store the Datalink.udl file anywhere on your system or network.
- Double-click the Datalink.udl file or right-click it and then click Properties. This opens the Data Link Properties dialog box. You are now ready to create your data connection.NOTE: The file's icon now looks like a computer with a datasheet in the background. If you still see the Microsoft Notepad text file icon, ensure that the file extension is showing correctly by following step 2. Then rename if necessary.
Steps to Build a Connection String
- Double-click Datalink.udl and use the Wizard as follows:
- Click the Provider tab.
- From the Providers menu, select the appropriate OLE DB or ODBC provider (you may only have OLE DB providers on your computer):
- select Microsoft Jet 4.0 OLE DB Provider for Microsoft Access 2000 or 2002 databases
- select Microsoft Jet 3.51 OLE DB Provider for Access 97 databases
- select OLEDB Provider for SQL for Microsoft SQL Server databases
- select OLEDB Provider for Oracle for Oracle databases
- Click Next to proceed to the Connections tab.
- With the Properties dialog box displayed, use the Connection tab to create a connection to a datasource:
- Type your database name or browse to the database you want to connect to.
- If you have created an account to use for Internet connections to the database, enter those credentials. Otherwise, you can use the default settings. (To use the default settings, enter Admin as the user name, and then select the Blank Password checkbox). If you do not want to use the default credentials, follow the steps under "Additional Information," later in this article, to configure the System database.
- Click test your connection to ensure that the connection will be successful.
- After you have successfully completed and tested your connection, click OK to save your new data link and close the Wizard.
Steps to Using Your UDL File
From the .udl file, the connection string can be copied and used in an application that supports MDAC technology.- Right-click the Datalink.udl file and rename it as Datalink.txt. Click Yes in the warning dialog box that appears.
- Double-click Datalink.txt, and a statement similar to the following appears:
[oledb]
; Everything after this line is an OLE DB initstring
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My.mdb;User ID=;Password=;
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My.mdb;User ID=;Password=;
Set objCXN = Server.CreateObject("ADODB.Connection")
strCXN = "Microsoft.Jet.OLEDB.4.0;Data Source=C:\My.mdb;User ID=;Password=;"
objCXN.Open strCXN
.
.
.
objCXN.Close
Set objCXN = Nothing
Additional Information
If you are specifying an Access database username and password, use the following steps to specify the path and the password to access the System.mdw file.In the UDL Wizard:
- Click the All tab.
- Select the field labeled Jet OLEDB.System database.
- Click Edit Value.
- In the Property Value box, type the path to the System.mdw file:C:\Program Files\Common Files\System\System.mdw
NOTE: Alter as necessary if the operating system is not installed on C:\. - Click OK in the Edit Property Value window.
- Select the field labeled Jet OLEDB:Database Password.
- Click Edit Value.
- In the Property Value box, type the password for the System database.
- Click OK in the Edit Property Value box.
- Click OK to close the Data Link Properties window.
Provider=Microsoft.Jet.OLEDB.4.0;Password=joe;User ID=jim;Data Source=C:\My.mdb;Persist Security Info=True;
Jet OLEDB:System database=C:\Program Files\Common Files\System\SYSTEM.MDW;Jet OLEDB:Database Password=14323