end_connection connection event

Processes any statements just before the MobiLink 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.

Parameters

None.

Default action

None.

Remarks

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

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

See also
SQL example

The following SQL script drops a temporary table that was created by the begin_connection script. This syntax is for a SQL Anywhere consolidated database. Strictly speaking, this table doesn't need to be dropped explicitly, since SQL Anywhere does 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 call to a MobiLink system procedure registers a Java method called endConnection as the script for the end_connection event when synchronizing the script version ver1.

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. (Note that printing a message to the MobiLink output log 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 call to a MobiLink system procedure registers a .NET method called EndConnection as the script for the end_connection connection event when synchronizing the script version ver1.

CALL ml_add_dnet_connection_script(
  'ver1',
  'end_connection',
  'TestScripts.Test.EndConnection'
)

Following is the sample .NET method EndConnection. It prints a message to the MobiLink output log. (Note that printing a message to the MobiLink output log might be useful at development time but would slow down a production server.)

public string EndConnection() {
  System.Console.WriteLine( "Ending connection." );
  return ( null );
}