Init (obsolete)

Description

Initializes an instance of the CORBACurrent service object for client- or component-managed transactions.

Obsolete function

Init is obsolete, because EAServer is no longer supported since PowerBuilder 2017.

Applies to

CORBACurrent objects

Syntax

CORBACurrent.Init ( { connection | URL} )

Argument

Description

CORBACurrent

Reference to the CORBACurrent service instance.

connection

The name of the Connection object for which a connection has already been established to a valid EAServer host. Either connection or URL is required if the Init function is called by a client.

URL

String. The name of a URL that identifies a valid EAServer host. Either connection or URL is required if the Init function is called by a client.


Return value

Integer.

Returns 0 if it succeeds and one of the following values if the service object could not be initialized:

-1 -- Unknown error

-2 -- Service object not running in EAServer (no argument) or Connection object not connected to EAServer (argument is Connection object)

-3 -- ORB initialization error

-4 -- Error on a call to the ORB.resolve_initial_references("TransactionCurrent") method

-5 -- Error on a call to the narrow method

Usage

The Init function can be called from a PowerBuilder component running in EAServer whose transaction property is marked as OTS style, or by a PowerBuilder client. The Init function must be called to initialize the CORBACurrent object before any other functions are called. EAServer must be using the two-phase commit transaction coordinator (OTS/XA) and a reference to the CORBACurrent object must first be obtained using the GetContextService function.

When Init is called from a PowerBuilder component running in EAServer, no arguments are required. If the calling component is not marked as OTS style, the CORBACurrent object is not initialized.

When Init is called from a PowerBuilder client and the client is responsible for the transaction, the CORBACurrent object must be initialized by calling Init with either a Connection object or a URL string as the argument. In the case of a Connection object, the client must already be connected to a valid EAServer host using that Connection object. Using a Connection object is preferred because the code is more portable.

Examples

This example shows the use of Init in a PowerBuilder EAServer component to initialize an instance of the CORBACurrent object:

// Instance variables:
// CORBACurrent corbcurr
int li_rc

li_rc = this.GetContextService("CORBACurrent", corbcurr)
IF li_rc <> 1 THEN 
    // handle the errorELSE
    li_rc = corbcurr.init()
    IF li_rc <> 0 THEN
      // handle the error
    END IF
END IF

In this example, Init is called by a PowerBuilder client application that has already connected to EAServer using the myconn Connection object and has created a reference called corbcurr to the CORBACurrent object:

li_rc = corbcurr.init( myconn )
IF li_rc <> 0 THEN
    // handle the errorEND IF

In this example, the PowerBuilder client application calls the Init function using a valid URL:

li_rc = corbcurr.init( "iiop://localhost:2000" )
IF li_rc <> 0 THEN
    // handle the errorEND IF

See also

BeginTransaction (obsolete)

CommitDocking

GetContextService

GetStatus (obsolete)

GetTransactionName (obsolete)

ResumeTransaction (obsolete)

RollbackOnly (obsolete)

RollbackTransaction (obsolete)

SetTimeout (obsolete)

SuspendTransaction (obsolete)