What is db2?

DB2 is one of the database managers of IBM, whom has already been several years in the market. In addition, it has been the precursor of many new technologies. At the time of the application creation, the version 9.7 has been released, with new features. (http://es.wikipedia.org/wiki/DB2)

The database manager has already much functionality; many of them can be used from a Graphical environment (GUI) and Command Line (CLI), others only in a Graphical environment and finally, others only in Command Line.

Then, in order to use this database, like a database administrator, like a developer or, like a normal user, it is necessary to know what do you want to do, and how do you want to do. In a Graphical environment, the how to use a functionality is easy, because the interface helps the user to do the operation, showing graphics, messages, wizards, etc. In the other hand, in the Command Line, the user has to know how to do what he wants to do.

What the Command Line is?

The Command Line has been always existed in the computers, and thanks to this environment, many system operations (sysadm) or database operations are done.

The Command Line normally is a black screen, with a prompt that permits to write commands, and to show the result generated by the computer of their execution.

The commands are a series of words, characters, numbers, or signs, that depending on the order how they are written, they will have a meaning for the computer. This is what is known as the grammar of a command. It is responsibility of the user to type the commands in an adequate way in order to be interpreted and processed by the computer (to write the parameters of a program.)

Problem description

With the huge quantity of available functionalities in DB2, and with the continued addition in each new version, to know the grammar of all the commands becomes difficult. Several times, the addition of new functionalities is simply the addition of a new parameter in a command. However, in other cases, the command use is changed completely, and it is necessary to know how the new structure is. This is because to be updated with the grammar of commands is a hard work, than can become something impossible, taking in account the quantity of commands that this database manager offers and, the quantity of available versions, with different functionalities in each of them.

How currently does the work done?

The Command Line user can work according to one of the next ways:

  • He knows completely the grammar of all commands, knowing the differences between different DB2 versions (This is almost impossible.)
  • He searches help of the command by typing in the Command Line.
    db2 ? create table

    For example, to ask for help about the command create table.

  • He asks for help in the Information Center https://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic

Why is it a problem?

The problem arises when a user knows what he has to do, but he does not know very well the grammar of the command to execute. Then, he has to analyze the documentation of the command to know how can do what he has to do. In several cases, this is done trying many times until he gets a right grammar for the command, and then he sees if the command that he executed did what he wanted to do.

Some commands have a complex grammar, because they can accept many parameters, and to understand this structure can be time consuming. Moreover, this spent of time can be unnecessary if the user had assistance, like the existing one in the Graphical environment.

Another criterion to know, as I already said, the user can use the "Information Center", but that implies to have access to a Graphical Interface, with a Web browser and to have access to this portal (that can be installed locally, or accessed vie Internet.) All this conditions are not always available, and then, the grammar analyzes becomes more complicated.

In addition, new DB2 users, who do not know the grammar of the commands, can expend a lot of time reading the documentation. This part is very exhausting, and it can discourage many users before they begin to work. Currently, there are many new users thanks to the available version for the community, DB2 Express-C, and those users have many questions about how to use the DB2 commands.

Concluding, the problem that we are facing is:

The user knows What he wants do to, but he does not know How to do that; and in order to understand the How to do, the user spends Time.


This video explains clearly why the current use is problematic.

Application Description

What is the application?

This application works like a syntax assistant for DB2 commands that works in Command Line. The application shows the possible parameters or options, while the user types a command.

How does it work?

In order to know the operation of the application, please go to section description.

Free and Open?

The code of this application is Open Source because it is licensed under the terms of LGPL v3. Also, it uses open components to execute. For example, the required libraries are Open Source, such as jLine and SLF4J. But also, its running environment, because Java is Free and Open.


The scope that was given at the time of the application conception, plus some ideas that have came up, is:

  • To assist the user in the lexical and syntactical part, taking in account the parameters and their order.
  • To assist the user in some aspects that go farther that the lexical and syntactical analyzes; instead, they can be some elements of the work environment. That means, if the commands needs a path in the file system, the application can help the user to complete it; or if the commands needs the name of a table in the database, the application can help to find the name. The objective is to extend the application, and not just limiting to a set of available options with the official distribution.
  • To permit that the grammar be extensible or changed completely in order to work in another environment.

Out of the initial scope of the application, there are other ideas of possible extension, but now they are just ideas.

  • To create an application for the iPhone that permits to control DB2 from this phone, assisting the user in the command completion like it currently exists in the terminal application of this phone.
  • In the new workspace for DB2, IBM Optim, create a pluglet that uses this application. Doing that, the command writing will be similar to the Java development environment in Eclipse.
  • A plugin that helps writing commands in the Technology Explorer, which is an administration and work environment for DB2, developed in PHP.


  • Version 2:
    • Convert the application to an OSGi Bundle.
    • To modify the structure of the grammar, in order to be more intuitive to define.
    • To create a plugin for IBM Optim.
  • Version 3
    • To create an assistant for iPhone that sends the commands to a server where the DB2 client is installed, because currently, there is no DB2 client for iPhone.
    • To create a plugin for the Technology Explorer, making calls from PHP to Java.


The idea was of Andrés Gómez Casanova, who is a DB2 DBA certified, and he did not just think about the problem, instead, he faced that problem several times.

For more details about the development group, please see the Team List from the last stable version (versions).