WATCOM INTERACTIVE SQL (ISQL)
![]()
![]()
ISQL is an environment that lets the developer execute SQL statements interactively and see the results of the query on the screen. The Watcom relational database system is included with PowerBuilder and Watcom SQL conforms to the ANSI SQL89 standard but has many additional features defined in the IBM DB2 and SAA specification and in ANSI SQL92.
When installed, PowerBuilder creates a Powersoft program group in Program Manager. This group contains an icon to launch ISQL and a sample database icon (PSDemoDB). In order to use ISQL you must be start the Watcom SQL database engine and connect to a database.
First launch the sample database by double clicking on the "Powersoft Demo DB" icon. A window appears, displaying some startup information. After a few seconds, the program automatically reduces to an icon on the bottom of the screen. Once the database engine is running, start ISQL by double clicking on the "Watcom Interactive SQL" icon. At the login prompt enter dba for the user ID and enter sql for the password. If you so choose, you can connect to a different database by going through "Database Tools" and choosing 'connect."
The ISQL Interface
The ISQL main window contains three text windows.
· THE COMMAND WINDOW -- This is the area where you type SQL commands and queries to send to the database, as well as instructions to ISQL itself. It is a standard Windows edit control. If more lines are typed than will fit in this window, the window automatically scrolls.
· THE STATISTICS WINDOW -- This window displays information such as the number of rows returned on a query.
· THE DATA WINDOW -- This window displays the rows of a database that are returned from a query.
You can scroll each of these windows using the cursor keys or the scroll bar on the right side of the window. These windows can also be made larger and maximized to full screen size in the standard Windows fashion.
Working in the ISQL Environment
Enter commands into the command window and executed them by pressing the execute key (F9) or by clicking the Execute button.
Multiple commands can be entered at one time by separating them with a semicolon. Before entering a new command be sure to clear the command window of all commands that were previously executed. It is better to store commands in a text file and load from that file by choosing Save or Open from the File menu, respectively.
Now that you have connected, you can explore the structure of the active database. Select Insert Table... from the Edit menu, or press the F7 key to display a dialog box that lists the tables in the current database. The table names are of the form DBA.table_name. The DBA prefix indicates that this database is owned by user ID DBA.
In addition to the tables that are part of the database, there are several system tables listed, which maintain information about the state of the database itself.
These tables can be inserted into by typing INSERT command from the command window. In other users are expected to use the same machine, please do not alter the sample database's structure or content. This is used by sample applications that are bundled with PB.
Connecting to a database from ISQL
To connect to a database after you are in ISQL type the command
CONNECT
in the command window, and click on the button labeled Execute.
ISQL will ask you to enter a user identification (user ID), and password
Type in the three-letter user ID "dba", and press the Tab key to move to the next field.
Type in the three-letter password "sql". The password does not appear when you type it. This prevents anyone else from seeing your password.
Watcom SQL databases are always created with user ID "DBA" and password "SQL."
The connect dialog contains a button labeled More>>. Pressing this button will reveal a larger dialog box which contains more options for connecting to the database engine. These options are as follows:
Connection Name:
This may be left blank unless you intend to open more than one connection to the database. If you do intend to open more than one connection, enter an identifying name for the connection here. You can then switch between different connections using the SET CONNECTION statement.
Database Name:
If you specify a database name in this field, ISQL will attempt to connect to a running database with that name. When a database is started a name may optionally be provided. This name identifies the particular instance of the database that is running. If a database is started without specifying a name, a default name is provided, which is the name of the database file with the path and extension removed.
Database File:
If you specify a database file in this field, and ISQL has not established a connection with a database using the Database Name field, ISQL will attempt to connect to a local database engine that matches the root of the file name. If no running database is found, ISQL will look for a database with this filename, start it, and connect to it.
Server:
The name of a Watcom SQL network server or database engine. If this field is left blank, ISQL will attempt to connect to the default local engine (the first database engine started).
Start Line:
If a start line is specified, and no running database has been found, ISQL will start a database engine using the command line specified in this field.
Press ENTER (or click the OK button) to connect to the database.
If you have made typing mistakes or if the demo database is not found, an error message will appear. You can use the tab key to move to the field in error and correct the problem using the cursor keys and the backspace key. If you successfully connect to the database, the statistics window should display the message "CONNECTED TO DATABASE".
Leaving ISQL
When you have finished working with ISQL, the EXIT command will return you to the operating system (or choose Exit from the File menu). You can stop the database engine by clicking on the Watcom SQL icon and selecting the Close menu item.
GO TO TOP
TAKING YOUR WATCOM DATABASE TO DIFFERENT MACHINES
This write up describes how to connect to your database when you have to transport your watcom database to different machines (We assume that the machine you are porting to have the necessary DLLs; Our lab machines have these installed.)
Many of you will be bringing your applications(assignments) in a floppy diskette to demonstrate to me, have it graded, or discuss certain questions with me. I cannot help you unless I can connect to the database that you are working on. It would be a constant source of frustration, if you cannot connect to your database properly.
In order to connect to your watcom database, you must have both your database the corresponding log file. Suppose you are working on a database that is called MEDICAL, you must copy both your MEDICAL.DB and MEDICAL.LOG to your floppy.
In the lab, first click the database icon to connect to the current database (mostly EXAMPLE), cancel and go to "CONFIGURE ODBC." It is important that you remove ( Delete) any existing profiles with the same name. This is because if any other student has used the same database name(very likely in our classroom setting) the profile names could be confusing. Then create a new profile for your database by just typing in the userid, password and Browsing to pick up your databasefile name from the floppy diskette.
You can gain additional insights into making database connections from the following links.
A technical note from Watcom describes the settings in ODBC.INI file for making proper connections to a Watcom Data Source.
![]()
Please send your comments to: Raghavan
© Dr. Vijay V. Raghavan
BACK TO Table of contents
BACK TO DATABASE Main Page
![]()