Contents Index download_statistics table event end_download connection event

MobiLink Synchronization Reference
  Synchronization Events

end_connection connection event


Function 

Processes any statements just before the MobiLink synchronization server closes a connection with the consolidated database server, either in preparation to shut down or when a connection is removed from the connection pool.

This script is normally used to complete any actions started by the begin_connection script and free any resources acquired by it.

Parameters 

None.

Default action 

None.

Description 

You can use the end_connection script to perform an action of your choice just prior to closing of a connection between the MobiLink synchronization server and the consolidated database server.

See also 

begin_connection connection event

SQL example 

The following Adaptive Server Anywhere SQL script drops a temporary table that was created by the begin_connection script. Strictly speaking, this table doesn't need to be dropped explicitly, since ASA will do this automatically when the connection is destroyed. Whether or not a temporary table needs to be dropped explicitly depends on your consolidated database type.

call ml_add_connection_script(
 'version 1.0',
 'end_connection',
 'drop table #sync_info' )
Java example 

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

call ml_add_java_connection_script(
   'ver1',
   'end_connection',
   'ExamplePackage.ExampleClass.endConnection' )

Following is the sample Java method endConnection. It prints a message to the MobiLink output log. (This might be useful at development time but would slow down a production server.)

public String endConnection()
{  java.lang.System.out.println( "ending connection" );
   return( null ); }
.NET example 

The following stored procedure call registers a .NET method called EndConnection as the script for the end_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',
  'end_connection',
  'TestScripts.Test.EndConnection'
)

Following is the C# signature for the call EndConnection.

public void EndConnection()

Contents Index download_statistics table event end_download connection event