Pattern: Host Access


You have to build an object/relational access layer alongside legacy applications on a host computer. Both suites of applications, the old transaction based applications and your new object-oriented applications should use the same host database access layer so that you have single source on you host computer. Most off the shelf access layer products are constructed on top of an ODBC interface. This does not combine well with a transaction system, as running a host as a remote SQL server is not the way things are handled.


How do you connect an object/relational access layer to a host computer running a transaction system?



Write all queries to a communication agent, using bundled write. Install another communication agent on your host computer that unpacks the query packets and executes them one by one under the control of the host transaction monitor. Send back a packet containing query results or the return codes of the access layer modules from the host computer.


Figure 7: Connecting and object/relational access layer to a host transaction system [Kel+98b ]

The structure (see Figure 7 ) shows the following similarities and differences compared to a normal object/relational access layer based on a remote database driver based on ODBC or similar:


Performance versus straightforward design: This solution offers reasonable performance, as we can see in more than one independent productive systems [Bar+95 , Sta+97 ]

Single source: is given, as the host database modules can be used from both object-oriented client applications and conventional host applications. A project  to write the host access layer can normally justified from the gains of productivity that result from using the host access layer from host applications alone.

Integration of legacy systems: It is straightforward to wrap another data source than a relational database by host access layer modules.

Related Patterns

This pattern is an application of proxies [GOF95 ] in the sense that the query objects on the client are proxies for the host access layer modules. The communication agents on the host and on the client implement bundled write.

Known Uses

The Hypo-Project [Bar+95 , Kel+98b ] uses this pattern as well as the Phoenix project. TopLink offers a separate mainframe interface as a byproduct to its standard access layer product. This is used in the Phoenix project [Sta+97 ] together with a host access layer written in C.