OLE DB is a new option for database connections. It is available under the database options of the MicroStation V8 installer in the 08.00.05.xx version or higher. OLE DB provides open data access and uses a standard set of COM interfaces for accessing and manipulating many different types of data.
These interfaces are commonly referred to as Data Providers. The choices you have in the Data Link Properties dialog, Microsoft Jet 4.0 OLE DB Provider or Oracle Provider for OLE DB, are the Data Providers that you have installed on your computer. You must contact your database vendor to determine if one is available for your database. Software like MicroStation that accesses data through OLE DB is called a Data Consumer. OLE DB interfaces can be developed to access very simple types of data as well as true relational databases. Therefore, OLE DB interfaces can access data that cannot be accessed using the current ODBC technology.
Before you can access data using OLE DB, you must set up a UDL, or MicroSoft Data Link, file. This is similar to setting up an ODBC data source in that you must provide some information about the data you wish to access. You must know the following:
- What data do you wish to access?
- Where is the data located (server name)?
- What is the database name?
A new database configuration file (..\Bentley\Program\MicroStation\config\database\oledb.cfg) has been added. In addition, a new database ID of 22528 has been added for database linkages created with an OLE DB connection. The MS_LINKTYPE value for OLE DB has been added to the oledb.cfg file.
#------ Database Linkages ------#
MS_LINKTYPE = OLEDB
To create a UDL file
- In Windows Explorer, navigate to the directory in which you want to store the UDL files. Right click in the right-hand pane of Windows Explorer and select Microsoft Data Link from the New menu. (see Figure 1)
 |
| Figure 1 |
If the Microsoft Data Link option is not available on your operating system, select the Text Document option. Once the text document has been created, rename the extension to .udl. It will now be recognized as a Microsoft Data Link file.
- You will now have created a file called New Microsoft Data Link.UDL (see Figure 2).
 |
| Figure 2 |
You may right-click on the file and select rename to give the file a more appropriate name.
- Next double-click on the UDL file to open the Data Link Properties dialog.
- Click the Provider tab, to see the list of OLE DB Providers found on your computer. If you do not see one for your database, contact the database vendor to see if one is available. For this example, we will set up a Microsoft Data Link to a Microsoft Access database by selecting the Microsoft Jet 4.0 OLE DB provider (see Figure 3).
 |
| Figure 3 |
- After the provider is selected, click the Next button to go to the Connection tab (see Figure 4).
 |
| Figure 4 |
You must enter the pertinent information for your database. This will differ based on the Provider selected. For this example, browse to the location of the delivered MicroStation Access database called GIS.mdb located in the ..\Bentley\Program\MicroStation\database\oledb\examples\access directory. You may also use the Test Connection button to verify the parameters that you have entered.
- In the Advanced Tab, you may set other initialization parameters for the data you are accessing. You must consult the documentation for the OLE Provider. For this example, no further configuration is necessary.
- Click OK to finish the MicroSoft Data Link setup.
For further information on creating a UDL connection, click here.
Connecting to an OLE DB data source
- Start MicroStation V8 and go to the Settings > Database > Connect dialog. Use the pulldown menu to switch the Database Server to OLEDB (see Figure 5).
 |
| Figure 5 |
- If you have already created a Microsoft Data Link (UDL) file, click the Database Source Button and Click the Browse option. This will open the Select Data Link dialog (see Figure 6).
 |
| Figure 6 |
- Click on the UDL file you wish to use and click Open. You will be connected to the database. Future connections to the database can be initiated by clicking the down arrow on the Database Source and picking the UDL file from the history list (see Figure 7).
 |
| Figure 7 |
Creating a UDL through MicroStation V8
- It is not necessary to create a UDL file prior to starting MicroStation V8. To have MicroStation create this file for you, go to the Settings > Database > Connect dialog and select OLE DB as the Database Server and Database Source set to New (see Figure 8).
 |
| Figure 8 |
- Click the OK button and provide a file name for the UDL file (see Figure 9).
 |
| Figure 9 |
The UDL file will be created with this name and a UDL extension, in the directory defined by MS_UDLDIR. By default, this is set to ..\bentley\Program\MicroStation\database\oledb\udl.
- The Data Link Properties Provider tab will be displayed. Continue with Step 4 from the "To create a UDL file" section above.
Editing a UDL file
- If it becomes necessary to edit the UDL file due to a change in the database location or connection information, you must first navigate to the folder where the UDL file resides, using Windows Explorer.
- Double-click on the UDL file and go to the Properties option in the list. You will be presented with the UDL properties dialog. Make the necessary changes to the file and click OK to save the file.
Note: Do not open the UDL file with a text editor to make changes. The UDL file may become corrupt.
Supported Data Providers
Following is a list of supported OLE DB providers:
- Microsoft Jet OLE DB Provider
- Oracle Provider for OLE DB
- Microsoft OLE DB Provider for SQL Server
While Microsoft also supplies an OLE DB provider for Oracle, we recommend the provider supplied by Oracle.
The following databases are supported with an OLE DB connection:
- Access 97
- Access 2000
- Oracle 8i
- Oracle 9i
- SQL Server 2000
New configuration variables for the OLE DB Server: