For a complete discussion of using transactions in a CORBA application, see Using CORBA Transactions.
• If the student exceeds the maximum number of credits the student can take, the University server application returns a TooManyCredits user exception to the client application. The client application provides a brief message explaining that the request was rejected. The client application then rolls back the transaction.Figure 5‑1 illustrates how the Transactions sample application works.Figure 5‑1 The Transactions Sample ApplicationThis section describes the steps used to add transactions to the Transactions sample application. These steps are in addition to the development process outlined in Chapter 3, “The Basic Sample Application.”During the development process, you would define in Object Management Group (OMG) Interface Definition Language (IDL) the register_for_courses() operation for the Registrar. The register_for_courses() operation has a parameter, NotRegisteredList, which returns to the client application the list of courses for which registration failed. If the value of NotRegisteredList is empty, the client application commits the transaction.You also need to define the TooManyCredits user exception.
• A call to the register_for_courses() operation so that students can register for courses.For information about using Transactions in client applications, see Getting Started with Oracle Tuxedo CORBA Applications and Using CORBA Transactions.
• Invocations to the TP::open_xa_rm() and TP::close_xa_rm() operations in the Server::initialize() and Server::release() operations of the Server object
• A method implementation for the register_for_courses() operationDuring the development process, you need the following in the UBBCONFIG file:
• The OPENINFO parameter defined according to the XA parameter for the Oracle database. The XA parameter for the Oracle database is described in the "Developing and Installing Applications that Use the XA Libraries" section of the Oracle7 Server Distributed Systems manual.
• For information about the transaction log and defining parameters in the UBBCONFIG file, see Setting Up an Oracle Tuxedo Application.During the development process, change the Transaction policy of the Registrar object from optional to always. The always Transaction policy indicates that this object must be part of a transaction. For information about defining Transaction policies for CORBA objects, see Using CORBA Transactions.
5. Load the UBBCONFIG file.
Note: In addition, you need to copy the utils directory into your work directory. The utils directory contains files that set up logging, tracing, and access to the University database.You will use the files listed in Table 5‑1 to create the Transactions sample application.
The C++ source code for method implementations of the CourseSynopsisEnumerator, Registrar, and RegistrarFactory interfaces. The UBBCONFIG file for the UNIX operating system. The UBBCONFIG file for the Windows operating system. The makefile for the Transactions sample application on the UNIX operating system. The makefile for the Transactions sample application on the Windows operating system. oradbconn.cpp and oranoconn.cpp samplesdb.cpp and samplesdb.h unique_id.cpp and unique_id.h samplesdbsql.h and samplesdbsql.pc The SQL for the University database. This file is located in the \utils directory.Use the following command to load the UBBCONFIG file:The build process for the UBBCONFIG file prompts you for an application password. This password will be used to log on to the client applications. Enter the password and press Enter. You are then prompted to verify the password by entering it again.The transaction log records the transaction activities in a CORBA application. During the development process, you need to define the location of the transaction log (specified by the TLOGDEVICE parameter) in the UBBCONFIG file. For the Transactions sample application, the transaction log is placed in your work directory.blocks specifies the number of blocks to be allocated for the transaction log and directorypath indicates the location of the transaction log. The directorypath option needs to match the location specified in the TLOGDEVICE parameter in the UBBCONFIG file. The following is an example of the command on Windows:During the development process, you would use the buildobjclient and buildobjserver commands to build the client and server applications. You would also build a database-specific transaction manager to coordinate the transactional events in the client/server application. However, for the Transactions sample application, this step has been done for you. The directory for the Transactions sample application contains a makefile that builds the client and server sample applications and creates a transaction manager called TMS_ORA.
Note: In the makefile, the following parameter is hard coded to build a transaction manager for the Oracle database:
•
•
•
•
2. At the Enter student id: prompt, enter any number between 100001 and 100010.
3.
4. At the Enter domain password: prompt, enter the password you defined when you loaded the UBBCONFIG file.
5.
2. At the Course Number prompt, enter a course number followed by -1 . For example:
3.
4. At the Options prompt, enter L to view a list of courses for which the student ID is registered.To exit the C++ CORBA client application, enter E at the Options prompt.