# &app; Manual V&manrevision;

## Introduction

The &app; application is the graphical interface to MDB Tools. You can use &app; to view and export data and schema from MDB databases.

## Getting Started

### To Start &app; from the Command Line

To start &app; from the command line, type the following command, then press Return:

`gmdb2`

#### &app; Window

Screenshot of the gmdb2 main window.

The &app; window contains the following elements:

Menubar.

- The menus on the menubar contain all of the commands you need to work with databases in &app;.

Toolbar.

- The toolbar contains a subset of the commands that you can access from the menubar.

Tabbed window.

- The tabbed window contains a tab for each type of object in the database. Within these, a listing of those objects will be displayed along with buttons along the left hand side for performing common actions specific to that type of object.

Statusbar.

- The statusbar displays information about current &app; activity and contextual information about the menu items.

When you right-click on any icon in the &app; icon list, the application displays a popup menu. The popup menu contains the full list of available actions that may be performed on that object.

### To Open a File

To open a file, choose File Open to display the Open File dialog. Select the file that you want to open, then click OK. The file is displayed in the &app; window.

The application also records the paths and file names of the last four files that you edited and displays them as menu items on the File menu. To open one of the last four files, choose for example File 1. `/path/filename` .

### To Open Files from a Command Line

You can run &app; from a command line and open a file. To open a file from a command line, type the following command, then press Return:

`gmdb2 file1.mdb`

When the application starts, the file that you specified is displayed in the &app; window.

&app; uses the environment variable MDBPATH when looking for the specified file. If set &app;will search each directory component until the file is found.

## Usage

### To Display the Properties of a Database

To display the properties of a database, perform the following steps:

1. Choose File Properties

### To Export the Schema of a Database

To export the schema of the current database, Choose Tools Export Schema and perform the following steps:

1. Select the filename to save the schema in.

2. If you want to only export one table, select it.

3. Choose the SQL dialect of the target database backend.

4. Check desired schema options.

5. Click Export.

Checking the Include Relationships box will generate foreign key relationships if they are supported by the database.

Checking the Include Drop Table commands will generate the commands to drop the tables before creating new tables.

### To Open a SQL Query Window

The SQL Query window allows you enter SQL queries and to execute and view the results.

To open the SQL Query window, perform the following steps.

1. Choose Tools SQL Window

### To Open a File Debugger Window

The File Debugger window allows you enter SQL queries and to execute and view the results.

1. Choose Tools Debug Window

## Preferences

To view or set Preferences choose Edit Preferences from the menu.

### Maximum Rows to Display

This option limits the number of rows that will be returned when

1. Clicking the Data button on the Tables tab window, or
2. Running a SQL select in the Query Window

By extension, this also affects the number of rows saved when saving the results of a SQL query.

If no value is set, the default number of rows displayed is 1,000. This option may be disabled by setting the value to 0, but be warned that attempting to display a large number of rows will result in an increased delay proportional to the number of rows.

## Table Actions

To perform actions on a table choose the Tables tab from the main window.

### Table Definition

To view the definition of a table, perform the following actions

1. Locate the desired table in the tables icon list.

2. Select the tables icon.

3. Click on the Definition button from the right hand side of the icon list.

Columns participating in a Primary Key will have an icon of a gold key and the letters PK at the left side of the column.

### Data View

The Data view displays a grid of the data in a table.

To display the table data, perform the following steps

1. Locate the desired table in the tables icon list.

2. Select the tables icon.

3. Click on the Data button from the right hand side of the icon list.

### Data Export

The Export button creates a text file containing the data from a single table.

To export the table data, perform the following steps

1. Locate the desired table in the tables icon list.

2. Select the tables icon.

3. Click on the Export button from the right hand side of the icon list to display the Export Table window.

4. Select the filename to save the data in.

5. Fill in dialog with desired characteristics of the export file.

6. Click Export.

Checking the Include Headers box will write a single row at the top of the file with the names of the columns.

## Query Window

To open the SQL query window choose Tools SQL Window

### &app; Query Window

Screenshot of the gmdb2 query window.

The &app; Query window contains the following elements:

Menubar.

- The menus on the menubar contain all of the commands you need to work with SQL queries and their results in &app;.

Toolbar.

- The toolbar contains a subset of the commands that you can access from the menubar.

Table List.

- The table list contains a list of tables for the current database that can be dragged into the query editor.

Query Editor.

- The query editor is a text editing window where you can write your SQL select.

Recent Queries List.

- The recent queries list can be used to bring a previously run query back into the query editor.

Results Window.

- The results window shows the results of the last SQL query executed.

### To Open a New Query Window

To open a new query window, choose Query New

### To Load a Query from a File

To load a query from a text file, choose Query Open

### To Save a Query to a File

To save the current query to a text file, choose Query Save

The active file can be found in the title bar of the window. If this is not the desired file, choose the Save As menu item.

### To Load a Query from a File

To load a query from a text file, choose Query Open