Getting Started-JetNet

Lesson 6 . Creating a Repository

When you begin to build a database application, you need to create a repository. A repository that resides on the server lets you as well as other members of the development team take advantage of its contents. You can directly, or via the screen wizard, use the database-derived objects in the repository to create client screens and service components.

In this lesson, you learn how to create a remote repository using the editor 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:

  1. If necessary, reactivate the application from the server machine (UNIX; Windows).

Connect to the middleware

When you start one of Panther's editors, such as the screen editor, menu bar editor, or JIF editor, and you want to access libraries through the middleware, you need to open a middleware connection. After you connect to the middleware, you can access libraries and repositories located on the server machine, and the data base specified in the server configuration.

  1. If necessary, start the editor.
  2. Depending on whether you invoke the editor from Windows (as a remote client) or UNIX (as a local client), use one of these procedures:

    Windows – The Connect dialog opens and displays the information you provided in your Windows initialization file. Choose OK to accept the settings.

    UNIX – Choose FileOpenMiddleware Session. The Connect dialog displays the location of the configuration file (broker.bin) as you specified in your environment setup.

  3. Choose OK.

    If the information is correct–that is, it matches the entries in your server setup–you are connected to the middleware. Otherwise, you have no access to the remote libraries on the server which are required for the tutorial.

    The editor workspace opens.

    Many commonly used commands and tasks can be executed by choosing the appropriate toolbar item. This tutorial acquaints you with most of the File menu commands that are associated with these toolbar buttons:

More About Toolbars

The editor's toolbar:

You can also use the Panther menu bar editor to create menus and toolbars to attach to individual screens or to the application as a whole.

Create a repository

Create a remote repository where you can store imported database objects.

  1. Choose FileNewRemote Repository.

    The New Remote Repository dialog opens.

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

    On startup, the editor automatically opens any local repository with the name data.dic.

    On Windows, to automatically open the remote repository, set the SMDICNAME variable to host!data.dic in your prtut.ini initialization file.

  3. Choose OK.

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

More About Repositories

You can create local as well as remote repositories when you are connected to the middleware and running a file access server. Remote repositories can be accessed by the development team and thereby provide a consistent appearance and behavior to your application. 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

A direct connection to the database (that is, not connecting through the middleware) allows you to import database definitions. A direct connection also lets you test a simple client/server model (two-tier processing) or the service component behavior in a three-tier, distributed application model.

  1. Choose FileOpenDatabase.

    The Choose Engine dialog opens.

  2. Choose OK to accept the defaults (in this case, jdb is the engine and the connection is dm_jdb0_conn). A database-specific dialog appears.

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.

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

    You are now connected directly to the local copy of the database. You also have a connection, via the middleware, to the remote database on your server which was made available when the server was activated.

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

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 Panther.

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 screen objects that inherit from repository objects are maintained without your having to access the database or manually edit client screens and service components. Development can continue even when the database is inaccessible or unavailable.

  1. Choose ToolsImport Database Objects on .

    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 entries 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 entries in the open repository.

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

What did you do?

In this lesson, you invoked the editor and:

What did you learn?

You learned: