在 MobiLink 同步服务器连接到统一数据库服务器时调用。
无。
无。
MobiLink 同步服务器在打开每个与统一数据库服务器的工作线程连接时执行该事件。MobiLink 同步过程在收到同步请求时打开连接。当应用程序创建或重新创建与 MobiLink 同步服务器的连接时,MobiLink 同步服务器将会临时分配一个与数据库服务器的连接,该连接在整个同步过程中持续。
下面的 SQL 脚本在 Adaptive Server Anywhere 统一数据库中运行。该脚本创建了两个变量,一个代表 last_download 时间戳,另一个代表员工 ID。
call ml_add_connection_script(
'custdb',
'begin_connection',
'create variable @LastDownload timestamp;
create variable @EmployeeID integer;')注意:Java 中通常不使用此脚本,这是因为您将在该类实例中使用成员变量而不是数据库变量,并在构造函数中准备成员。
下面的存储过程调用在同步脚本版本 ver1 时将名为 beginConnection 的 Java 方法注册为 begin_connection 事件的脚本。此语法用于 Adaptive Server Anywhere 统一数据库。
call ml_add_java_connection_script(
'ver1',
'begin_connection',
'ExamplePackage.ExampleClass.beginConnection' )下面是示例 Java 方法 beginConnection。这将返回创建连接级别变量的 SQL。
public String beginConnection()
{ return("create variable @LastDownload timestamp;" ); }下面的存储过程调用在同步脚本版本 ver1 时将名为 BeginConnection 的 .NET 方法注册为 begin_connection 连接事件的脚本。此语法用于 Adaptive Server Anywhere 统一数据库。
call ml_add_dnet_connection_script( 'ver1', 'begin_connection', 'TestScripts.Test.BeginConnection' )
下面是调用 BeginConnection 的签名。
public string BeginConnection()
{ return("create variable @LastDownload timestamp;" ); }SQL Anywhere Studio 9.0.2
版权所有 © 1989–2005 Sybase, Inc. 部分版权所有 © 2001–2005 iAnywhere Solutions, Inc. 保留所有权利。