| DB Access Class Library for COBOL V1.0 API Reference - Microsoft(R) Windows(R) - - Microsoft(R) Windows NT(R) - - Microsoft(R) Windows(R) 2000 - |
Contents
Index
![]()
|
Chapter 6 DB Access Library API Reference
6.4 Creating an Object
Creates an object of the CREATE-OBJECT class using a CREATE-OBJECT method.
INVOKE FJDB-COMMAND "CREATE-OBJECT" USING SQL DSN UID PWD SCM OPT ERROR-A
RETURNING COMMAND-A.
SQL [attribute:X(nn) nn is an area length]
Enters an SQL statement. Each dynamic parameter appearing in the SQL statement is designated by a question mark (?).
(Sample entry)
"UPDATE S1.T1 SET A=? WHERE A=?"
DSN [attribute:X(nn) nn is an area length]
Specifies a database environment name.
UID [attribute:X(nn) nn is an area length]
Specifies the user ID to connect to the database.
PWD [attribute:FX(nn) nn is an area length]
Specifies the password associated with the user ID used to connect to the database.
SCM [attribute:X(nn) nn is an area length]
Specifies the default schema name for the SQL statement that is specified in the OPEN-RECORDSET method, the CREATE-COMMAND method, or the EXECUTE-SQL method aimed at an object of the FJDB-DATABASE class.
The default schema name complements a table when it is not qualified by a schema name in the SQL statement that is specified in the OPEN-RECORDSET method, EXECUTE-SQL method, and the CREATE-COMMAND method.
OPT [attribute:S9(9) COMP-5]
Specifies a database run-time option with a symbolic constant or integer. A mix of multiple symbolic constants, or associated values, can be used to specify multiple options.
(Specifying multiple options)
COMPUTE OPT = FJDB-SCDBOPT-READONLY + FJDB-SCDBOPT-READCOMMITED
INVOKE FJDB-COMMAND "CREATE-OBJECT" USING SQL ` OPT ERROR-A
RETURNING COMMAND-A.
Available options are listed below.
(1) Database updatability attribute mode
iFJDB-SCDBOPT-READONLY)
Decide whether to make the open database both readable and writable or read-only. The default is both readable and writable.
(2) Isolation level mode
(FJDB-SCDBOPT-READCOMMITED)
Decide whether to set the isolation level as READ COMMITED or READ UNCOMITTED. The default is READ UNCOMMITED.
The isolation level is a transaction mode in which reference and update to data are controlled to enable multiple transactions to gain access to the same resource without causing data inconsistencies.
| Symbolic constant | Value | Meaning |
| FJDB-SCDBOPT-DEFAULT | 0 | Do not use any option. |
| FJDB-SCDBOPT-READONLY | 1 | Open the database with a read-only attribute. |
| FJDB-SCDBOPT-READCOMMITED | 2 | Set the isolation level as READ COMMITED. |
ERROR-A [attribute:OBJECT REFERENCE FJDB-ERROR]
Returns an object of the FJDB-ERROR class if the method fails to end normally.
COMMAND-A [attribute:OBJECT REFERENCE FJDB-COMMAND]
Returns an object of the FJDB-COMMAND class if the method ends normally; otherwise, returns a NULL object.
A library file having symbolic constants defined in it, FJDBOPT.CBL is stored in the COPY folder of the folder in which the DB access class library is installed. To use symbolic constants in a program, see the following instructions:
Example:
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
SYMBOLIC CONSTANT
COPY FJDBOPT.
.
Contents
Index
![]()
|