Collection Contents 上一页 下一页 PDF

MobiLink 管理指南

同步事件

end_connection 连接事件


功能 

紧接在 MobiLink 同步服务器关闭与统一数据库服务器的连接之前,在准备关机或从连接池中删除连接时处理任何语句。

该脚本通常用于完成 begin_connection 脚本所启动的所有操作并释放其占用的所有资源。

参数 

无。

缺省操作 

无。

说明 

您可以使用 end_connection 脚本紧接在 MobiLink 同步服务器与统一数据库服务器之间的连接关闭之前执行所选的操作。

另请参见 
SQL 示例 

下面的 Adaptive Server Anywhere SQL 脚本删除由 begin_connection 脚本创建的临时表。严格地讲,并不需要显式删除该表,因为 ASA 将在连接被破坏时自动执行此操作。是否需要显式删除临时表取决于统一数据库的类型。

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

下面的存储过程调用在同步脚本版本 ver1 时将名为 endConnection 的 Java 方法注册为 end_connection 事件的脚本。

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

下面是示例 Java 方法 endConnection。它将消息输出到 MobiLink 输出日志。(这在开发时可能会有帮助,但会降低生产服务器的性能。)

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

下面的存储过程调用在同步脚本版本 ver1 时将名为 EndConnection 的 .NET 方法注册为 end_connection 连接事件的脚本。此语法用于 Adaptive Server Anywhere 统一数据库。

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

下面是示例 .NET 方法 EndConnection。它将消息输出到 MobiLink 输出日志。(这在开发时可能会有帮助,但会降低生产服务器的性能。)

public void EndConnection()
{  System.Console.WriteLine( "ending connection" );
   return( null ); }

Collection Contents 上一页 下一页 PDF