Contents Index authenticate_user_hashed connection event begin_connection_autocommit connection event

MobiLink Synchronization Reference
  Synchronization Events

begin_connection connection event


Function 

Invoked at the time the MobiLink synchronization server connects to the consolidated database server.

Parameters 

None.

Default action 

None.

Description 

The MobiLink synchronization server executes this event upon opening each worker-thread connection to the consolidated database server. The MobiLink synchronization opens connections on demand as synchronization requests come in. When an application forms or reforms a connection with the MobiLink synchronization server, the MobiLink synchronization server temporarily allocates one connection with the database server for the duration of that synchronization.

See also 

end_connection connection event

SQL example 

The following SQL script works in an Adaptive Server Anywhere database. Two variables are created, one for the last_download timestamp, and one for employee ID.

call ml_add_connection_script(
    'custdb',
    'begin_connection',
    'create variable @LastDownload timestamp;
    create variable @EmployeeID integer;')
Java example 

Note: This script is not generally used in Java, because instead of database variables you would use member variables in this class instance, and prepare the members in the constructor.

The following stored procedure call registers a Java method called beginConnection as the script for the begin_connection event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_java_connection_script(
    'ver1',
    'begin_connection',
    'ExamplePackage.ExampleClass.beginConnection' )

Following is the sample Java method beginConnection. This returns SQL that will create a connection level variable.

public String beginConnection()
{ return("create variable @LastDownload timestamp;" ); }
.NET example 

The following stored procedure call registers a .NET method called BeginConnection as the script for the begin_connection connection event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_dnet_connection_script(
   'ver1',
   'begin_connection',
   'TestScripts.Test.BeginConnection'
)

Following is the signature for the call BeginConnection.

public void BeginConnection()

Contents Index authenticate_user_hashed connection event begin_connection_autocommit connection event