UseContextObject

Description

Specifies that PowerBuilder controls a transaction using the transaction service context object TransactionServer. This parameter applies only when a PowerBuilder custom class user object is deployed as an EAServer or COM+ component.

Applies to

NoteDatabase interface restrictions EAServer requires the SYJ interface Sybase EAServer uses a slightly different version of the CT-Lib software. Therefore, at runtime, you need to use the SYJ database interface rather than ASE or SYC to connect to an Adaptive Server Enterprise database. The SYJ Database Profile Setup dialog box provides a convenient way to set the appropriate connection parameters and then copy the syntax from the Preview page into the script for your Transaction object.

You cannot use the SYJ interface, however, to connect to the database in the PowerBuilder development environment. Therefore, during the development phase (before the component has been deployed to EAServer), you must use ASE or SYC to connect to the database.

Syntax

UseContextObject='value'

Default

UseContextObject=No

Usage

PowerBuilder provides a transaction service context object called TransactionServer that gives you access to the transaction state primitives that influence whether EAServer or COM+ commits or aborts the current transaction. If you use the TransactionServer context object by setting the UseConnectObject parameter to Yes, COMMIT and ROLLBACK statements called on the Transaction object result in a runtime error.

By default, the TransactionServer context object is not used. Instead, you can use COMMIT and ROLLBACK statements to manage transactions. In this case, COMMIT is interpreted as a SetComplete function and ROLLBACK is interpreted as a SetAbort function. This approach is recommended only when you want to migrate PowerBuilder 6.x or prior objects to EAServer or COM+ without modifying the code.

Setting UseContextObject to Yes is incompatible with the use of the SetTrans function. The SetTrans function is used when you want the DataWindow engine to manage database connections, transaction state primitives, and related EAServer component deactivation.

Because the default Web DataWindow component uses SetTrans to specify database connection information, you must not set UseContextObject to Yes in your database profile or in the EAServer properties for the component.

For information on how to use PowerBuilder to build EAServer and COM+ components, see Application Techniques.

Examples

Example 1

To use the TransactionServer context object:

See also