This lesson assumes you have completed all preceding lessons. See Lesson 1: Compiling the CustdbScripts Java class with MobiLink references.
In this lesson, you use Sybase Central to specify a Java method as the script for the ULCustomer upload_insert event. You connect to the CustDB database using Sybase Central, replace the upload_insert SQL script with a Java script, and specify CustdbScripts.UploadInsert to handle the event.
Alternatively, you can use the ml_add_java_connection_script and ml_add_java_table_script stored procedures. Using these stored procedures is more efficient, especially if you have a large number of methods to handle synchronization events. See ml_add_java_connection_script system procedure and ml_add_java_table_script system procedure.
In Sybase Central, click View » Folders.
In the left pane of Sybase Central under MobiLink 12, expand mljava_project, Consolidated Databases, mljava_db, Synchronized Tables, ULCustomer.
In the right pane, select the custdb 12.0 upload_insert table script. Click Edit » Delete.
Create a new upload_insert table script.
Click File » New » Table Script.
In the For Which Version Do You Want To Create The Table Script list, click custdb 12.0.
In the Which Event Should Cause The Table Script To Be Executed list, click upload_insert, and click Next.
Select Create A New Script Definition, and select Java.
Enter the Java method name to load for the custdb 12.0 upload_insert table script.
In the right pane of Sybase Central, use the following Java script for the upload_insert event:
Click File » Save to save the script.
Close Sybase Central.
Discuss this page in DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|