Database Concepts  «Prev 

Setting up Virtual BookShelf

Adding a Data Environment

  1. With the VirtualBookShelf project open, add a data connection by right-clicking the project name to display a menu of available actions.
  2. Select Add Data Connection.
  3. The Select Data Source dialog is displayed. There are two types of data sources to select from. File data sources are stored in a file on the client computer. Machine data sources are stored on the system and have a user-defined name, called a data source name (DSN). All the information the Driver Manager and driver need to connect to the data source is associated with the DSN. DSNs are stored in the system registry and are visible to login accounts and to applications running as a service. Therefore, machine data source is the best choice.
  4. The Machine Data Source tab lists the DSNs already stored on the machine. We want to create a new source, so click New.
  5. The Create New Data Source Wizard is displayed. Notice, by default, User Data Source is already selected. An explanation of User Data Source is provided in the text box at the bottom of the image. However, you want to select System Data Source.
  6. Note the explanation of System Data Source in the text box at the bottom of the image. Click Next to continue.
  7. A list of available database drivers is displayed. The virtualbook.mdb database is a Microsoft Access database, so you would select the Microsoft Access Driver. This driver is selected by default so you won't actually have to select it, just click Next.
  8. Congratulations! You selected the correct driver. Click Finish to continue.
  9. The ODBC Setup dialog is now displayed. From here, you will create a data source to reference the VirtualBook [virtualbook.mdb] database. Give the data source a name by entering VirtualBook in the name box. Now give the data source an easily recognized description that associates it with the VirtualBook database. Enter VirtualBook Database in the Description Box. You need to make sure the data source actually references a database. Click Select to browse your files for the VirtualBook_Local directory. For the purpose of this simulation, we'll do the browsing for you.
  10. Since we have already browsed the directory for you, just select VirtualBookShelf by double-clicking.
  11. The VirtualBook_Local directory is expanded, and notice the virtualbook.mdb database is listed in the list box on the left. Select the database by clicking its name.
  12. Now click OK.
  13. Now you are back to the ODBC Setup dialog, click OK.
  14. Now you are back to the Select Data Source dialog, click OK.
  15. The Connection1 Properties dialog is displayed. It is time to assign a more meaningful name to the connection, so enter vbookconn in the name box. Click OK.
  16. You are now completed. The Data Environment is shown in the Project Explorer window under Global.asa. Notice that vbookconn is listed under the Data Environment within Global.asa. Its presence confirms that the connection to the database is established in Global.asa. This is the end of the simulation.