Navigation:  Programming Cookbook > Database Connectivity >

Setting up a Sample Data Source

Previous pageReturn to chapter overviewNext page

The documentation that follows is in a tutorial style that takes you through the various stages of connecting to a database and executing SQL queries etc. In order to do this we use a number of examples that are based on a particular sample database. We have chosen to use the NorthWind traders sample database that comes as a part of the Microsoft Access and Visual Basic product lines (amongst others). This comes as the file Nwind.mdb and requires the Access (or Jet) database engine to be installed. If are able to make use of this sample then the first stage is to set up an ODBC Data Source to access it.

If you can't use the NorthWind database then you should set up another appropriate sample Data Source by following the instructions provided by your chosen database supplier. You will obviously then have to tailor the examples in this tutorial appropriately.

To set up a data source you use the ODBC applet available from your Windows Control panel. The exact appearance of this depends on which version of Windows you are using. The figures below show the ODBC applet for Windows XP.
 

Click on the Add button and select an appropriate driver. In this case we are assuming use of the Microsoft Access Driver (*.mdb ).

You will be prompted fill in additional details about the data source as follows.
Note that you should click on Select.. to locate the actual Nwind.mdb data file. You may also use the Advanced.. button to allocate a default username and password for accessing the database but for the time being this is not actually necessary. The end result will be an entry for your new Nwind data source in the ODBC administrator.