HP (Hewlett-Packard) c-tree-SQL ISQL and Tool reference Guide Printer User Manual


 
Quick Tour
FairCom Corporation 2-9
2.3 LOCKING TUTORIAL
iSQL_Tutorial3.sql
This tutorial will introduce the concept of locking. The function-
ality for this tutorial focuses on adding records, then updating a
single record to the customer master table. From the iSQL utility
the script will be parsed and passed to the server. The script com-
pletes without "committing" the update. This leaves the updated
record locked. The user will launch another instance of the Inter-
active SQL utility in another window which will block, waiting on
the lock held by the first instance. Typing "COMMIT WORK;" from the first instance of the
iSQL utility will complete the update transaction and remove the lock. This will allow the sec-
ond instance to continue execution. Launching two processes provides a visual demonstration
of the effects of locking and a basis for experimentation on your own.
It is important to note that locking is inherent at the SQL level. This means that when one pro-
cess has a record selected for update, it is locked even though there is no explicit SQL syntax.
This tutorial operates on the assumption that the database named 'myDatabase', already exists.
Please refer to Section 3.6 “Introduction to the c-treeSQL ISQL Utility” in c-tree Plus Quick
Start and Product Overview Guide for details on how to set up the environment for the tutorial.
This example, like all others in this set of documentation, will take the creation and use of a
database and fit it into a simple four step flow of initialization, definition, management, and
completion. (Init, define, manage, and you're done!)
Now let's break into the four areas.
2.3.1 Init
The initialize step is as simple as launching the iSQL tool. The
syntax for this is as follows:
isql [-u user_name] [-a password] [connect_string]
At the command line prompt type:
isql -u ADMIN -a ADMIN myDatabase
iSQL responds with the following prompt:
ISQL>
At this point, any valid SQL statement terminated with a semi-colon may be submitted.