Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » MobiLink - 服务器管理 » MobiLink 事件 » 同步事件

 

end_connection 连接事件

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

参数

无。

缺省操作

无。

注释

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

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

另请参见
SQL 示例

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

CALL ml_add_connection_script(
 'version 1.0',
 'end_connection',
 'DROP TABLE #sync_info' )
Java 示例

以下对 MobiLink 系统过程的调用在同步脚本版本 ver1 时将名为 endConnection 的 Java 方法注册为 end_connection 事件的脚本。

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

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

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

以下对 MobiLink 系统过程的调用在同步脚本版本 ver1 时将名为 EndConnection 的 .NET 方法注册为 end_connection 连接事件的脚本。

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

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

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