PreviousTutorials and Guide to Samples (9.1 revision 1) Next

Lesson 1: Setting Up Your Environment

Show this topic in Library frames

This section discusses the tasks you must perform so that any ODBC-enabled application (such as Microsoft Visual Basic) can connect to your Pervasive data. The tasks are as follows:

Installing the Prerequisite Software

You must have the following software installed:

For information about how to install these components, refer to Getting Started with Pervasive.SQL.

Copying the Sample Database

This tutorial uses the sample database, which is installed with Pervasive.SQL. The following procedure guides you through making a personal copy of the sample database, so that you can make changes without affecting the original installation.

To copy the sample database:

  1. Find the sample database installed with Pervasive.SQL. Typically, you can find the sample database in the \Pvsw\Demodata directory on your Pervasive.SQL server.
  2. Create a new folder in the Demodata directory and give it your network user name.
  3. Highlight and copy all the files in the \Demodata folder into your personal folder. Use this personal folder for the rest of the tutorial.

Create a New Database Name and DSN For the Copy

A data source specifies a database you want to access, the ODBC driver you want to use, and other connection-related information. For each database you want to access, you must define a separate data source using the ODBC Administrator.

To define a data source and a database name:

  1. Start the Pervasive.SQL Control Center by choosing Start > Programs > Pervasive > Pervasive Control Center.
  2. Display the database engines that are registered with your Pervasive Control Center by double-clicking Pervasive.SQL Engines.
  3. If you do not see the database engine that you want to use, choose Action > Register New Engine and choose a database server on the network. Otherwise, proceed to the next step.
  4. Click on the icon for the database engine you want to use. Select Action | New Database.
  5. Note: If you are using a server engine on another machine, you must have administrative rights in the server operating system in order to create a new database.

  6. Follow the instructions in the wizard to create a database name and a DSN for your DEMODATA copy. You may use any name that is not already used as a DSN name.

Creating Data Dictionary Files

Read this section if you have Btrieve data that does not have .ddf files or that has blank .ddf files.

A data dictionary is a set of .ddf files that describe your Btrieve data in terms of tables, columns, and indexes. (In Btrieve terminology, these are files, fields, and keys.) A Btrieve database does not explicitly contain information that describes the format and meaning of the data in the database; instead, this information is defined in the Btrieve application.

The data dictionary defines the components of a database so that ODBC, Pervasive.SQL 2000, and a variety of other commercial tools and applications can access your Btrieve database. The minimum set of .ddf files required is File.ddf, Field.ddf, and Index.ddf. Your database must have these files so that Visual Basic can connect to it.

The .ddf files must accurately describe your database in order to be useful to Visual Basic. To help with this, Pervasive provides Pervasive.SQL Control Center, a tool that helps define tables, columns, and indexes for your database. For more information, refer to Pervasive.SQL User's Guide.

Creating the Tutorial Project

This procedure simply creates a new project in Visual Basic that you can use in subsequent lessons.

To create the tutorial project in Visual Basic:

  1. Start Microsoft Visual Basic. If Visual Basic is configured to display the New Project dialog at startup, skip to step 3.
  2. Choose New Project from the File menu.
  3. If you are using Visual Basic 3 or 4, this task is complete; you can skip to the next lesson. If you are using Visual Basic 5, continue with the next step.

  4. In the New Project dialog box, select Standard EXE and click OK.


  5. Right-click on the Toolbox window and choose Components.
  6. In the Components dialog box, check Microsoft ADO Data Control 6.0 (OLEDB) and Microsoft DataGrid Control 6.0 (OLEDB) and click OK.


  7. If necessary, resize the Toolbox to show the data bound controls you just added.



Chapter contents
Publication contents

Prev topic: Using Microsoft Visual Basic with Pervasive Data
Next topic: Lesson 2: Using the ADO Data Control (ADODC)