Database Access

Uniface automatically opens the DBMS when a read or write ProcScript statement is issued. The path and logon details for the specific database (or databases) can be provided in an assignment file, a command line instruction, or in the open ProcScript instruction.

Opening the Database

Unless otherwise instructed by an open ProcScript statement, Uniface automatically opens the DBMS when a read or write ProcScript statement is issued for the DBMS.

To open any DBMS, Uniface requires a path assignment. For many database systems, you also have to supply logon information. You can supply this information in an assignment file or with the /log switch. If a path definition includes question marks or no logon information, the DBMS Log On dialog is displayed when Uniface needs to access information from a DBMS requiring an explicit logon.

Log On Dialog

Graphical content.

Clicking Cancel causes an implicit and immediate apexit; that is, you exit the application immediately.

When opening and logging on to databases, Uniface issues the O Open and L Logon connector requests, which are recognized by all database connectors.

Closing the Database

When an application ends normally, Uniface explicitly closes all files and tables used during the application session and closes all databases. Uniface only closes the files and tables if the application ends normally (that is, without an interrupt, or system failure, or the apexit instruction and so on).

If Uniface does not close the files or tables due to an abnormal termination of the application session, the DBMS or operating system must close them.

You can explicitly close files or tables and log off from a DBMS with the close ProcScript instruction. This instruction causes Uniface to close all tables and files accessed on the path specified with the close instruction and then log off from that DBMS. If no tables or files are open, Uniface cannot log off. The close ProcScript instruction results in an implicit rollback or commit depending on the DBMS.

When closing and logging off a database, Uniface sends Z Close and A Logoff connector requests to the DBMS connector.

Opening and Closing a Record-Level DBMS

When opening files in a record-level DBMS, for which a lock does not need to be specified, Uniface attempts to open files with read and write access. If this fails, Uniface opens them with read-only access. Users can read data without a problem, but any attempt to update causes the appropriate message to be returned.

When opening files in other record-level DBMS for which a lock must be specified, Uniface opens the files with read and write access, even if you want only read-only access, because specifying a lock makes it is no longer possible to access the files as read-only.

Closing a path to a file management system causes all Uniface paths to that system to be closed. This is because such systems are not accessed via paths in the same way as a field-level RDMS such as Sybase or Oracle. The close operation closes all open files.

Related Topics