Getting Started-2-Tier


Lesson 3 . Creating a Repository

When you begin to build a database application, you need to create a repository. A repository lets you take advantage of the contents of the database. You can directly, or via the screen wizard, use the database-derived objects in the repository to create screens.

In this lesson, you learn how to create a repository and populate it with imported database objects. The import process creates a screen, or repository entry, in the open repository for each database table that you import. The repository entry contains widgets representing each column defined in the database table.

In this lesson you learn how to:

Start the editor

Depending on whether you invoke the Panther editor from Windows or UNIX, use one of these procedures:

The editor workspace opens.

Create a repository

Create a repository where you can store imported database objects.

  1. Choose FileNewRepository.

    The New Repository dialog opens.

  2. Enter data.dic as the name of a repository in the File Name field.

    On startup, Panther automatically opens any local repository with the name data.dic. To open a repository with a different name, edit your initialization file and set the application variable SMDICNAME to the repository's path.

  3. Choose Save.

    Note: Creating a new repository automatically closes any repository that is open.

More About Repositories

You can control the look and feel of application objects by modifying objects in a repository. From this centralized location, you can use and reuse the objects throughout the development of your application. Changes that you make to repository objects automatically propagate to the various screens that contain copies of the objects. This greatly simplifies both application development and maintenance.

Connect to the database

In order to import database definitions, the editor must be directly connected to one of the database engines that Panther supports, including its own database engine JDB.

A Panther client can establish a connection to the database engine directly and through Panther's web application server. In this lesson, you will connect to JDB directly; in Lesson 2, you set up the web application server so it can connect to a database engine and let you test application screens from your browser.

  1. Choose FileOpenDatabase.

    The Choose Engine dialog opens.

  2. Choose OK. A database-specific dialog appears.

  3. Select or specify vidsales in the File Name field, then choose Open.

    You are now connected to the database.

    Note: If the vidsales database is not in your current directory, locate it with the dialog.

More About JDB

JDB is Panther's single-user SQL database. You can use it to quickly prototype your application and refine multi-user database applications without the need for an external third-party database.

Import database tables

When you import database objects into the repository, you can take advantage of the data definitions already in the database. The import process creates one screen in the repository for each selected database object. The contents of the resulting repository screens can be used to build application screens that access data. The next few steps show how to import database information into the Panther editor.

More About Importing Database Objects

You can import database table definitions into the repository at the outset of your development process, and reimport whenever the database schema changes.

Also, if your database engine supports other database object types, such as views and synonyms, you can import those as well.

All application objects that inherit from repository objects are maintained without having to access the database or manually edit screens. Development can continue even when the database is inaccessible or unavailable.

All application objects that inherit from repository objects are maintained without having to access the database or manually edit screens. Development can continue

  1. Choose ToolsImport Database Objects or .

    The Import Database Objects dialog opens. All tables in the vidsales database are listed.

    When you select a table, the detail information for the table is displayed in Column Descriptions: column name, data type, and length. You can select multiple tables simultaneously: click+drag or Shift+click to select contiguous objects; Ctrl+click to select noncontiguous objects.

  2. Choose Select All to select all of the tables in the database.
  3. Choose Import.

    The status line informs you of each table imported into the repository and notifies you when the import process is completed.

  4. When the import is complete, choose Close to return to the editor.

View repository contents

You can use the repository table of contents (TOC) to select and open repository screens successively for copying and editing purposes. The TOC can remain open during your editing session.

  1. Choose ViewRepository TOC.

    This menu option toggles the display of the Repository table of contents. The TOC opens and displays a list of all screens in the open repository.

  2. (Optional) Leave the Repository TOC open so you can easily access repository screens. To close the TOC, choose ViewRepository TOC, or choose Close/Quit from the TOCs system menu.

What did you do?

In this lesson, you performed these tasks:

What did you learn?

You learned: