HPlogo ALLBASE/SQL Advanced Application Programming Guide: HP 3000 MPE/iX Computer Systems

Chapter 7 Transaction Management with Multiple DBEnvironment Connections

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

It is possible to establish a maximum of 32 simultaneous database connections. When your application must access more than one DBEnvironment, there is no need to release one before connecting to another. Performance is greatly improved by using this method rather than connecting to and releasing each DBEnvironment sequentially.

This multi-connect functionality is available in either of two modes. Single transaction mode allows one transaction at a time to be active in the currently connected set of DBEnvironments. Multi-transaction mode allows multiple, simultaneous transactions across the currently connected set of DBEnvironments with a maximum of one active transaction per connection. The ALLBASE/SQL Reference Manual contains an introductory explanation in the "Using Multiple Connections and Transactions with Timeouts" section of the "Using ALLBASE/SQL" chapter. Complete syntax is presented in the "SQL Statements" chapter under SET CONNECTION and SET MULTITRANSACTION. The present chapter concentrates on application programming issues.

There are numerous scenarios in which multi-connect functionality could be useful. For example, a DBEnvironment maintenance application to be run in single-user mode might use multiple, nested transactions to select data from one DBEnvironment, insert it into another, then delete the selected data from the original DBEnvironment. Another application of multi-transaction mode might involve a subroutine that contains a security audit log transaction. The subroutine is called from within a complex transaction whenever a user requests access to data in a particular table. Another scenario might be a windows based application that displays information from several DBEnvironments. This chapter presents some general considerations and provides a pseudocode example. The following topics are addressed:

  • Preprocessing and Installing Applications.

  • Understanding Timeouts.

  • Using Timeouts to Prevent Undetectable Deadlocks.

  • Using Timeouts to Prevent Infinite Waits.

  • Using Timeouts to Tune Performance.

  • Example Using Single-transaction Mode with Timeouts.

Note that although multiple DBEnvironment connections are possible, a given transaction must require resources from just one DBEnvironment.

Feedback to webmaster