em 404 new mobilink technology jim graham director of engineering ianywhere solutions...
TRANSCRIPT
MobiLink
C onsolidatedD atabase
C om m unication Infrastructure( In ternet / D ia l-up / W ire less )
Data Data
DataData
Data
M obiL ink
Data
Data
M obile or R em ote D atabases
MobiLink Design Goals
• Heterogeneous consolidated database
• Scalable and robust (tens of thousands)
• Manageable in large deployments
• Support handheld and wireless devices
• Flexible
How Synchronization Works
• 1. Upload• ASA or UltraLite keep track of all changes since
previous synchronization
• All changes are sent in a single upload stream
• MobiLink applies changes in a single transaction
• 2. Download• Scripts in the consolidated database determine changes
that need to be downloaded
• All changes are sent in a single download stream
• 3. Acknowledge download
MobiLink Synchronization
C onsolidatedD B
M obiL ink
R em ote ASAD atabase
O D BC
dbm lsync
1. U pload
2. D ow nload
3. Ack D ow nload
MobiLink Scripts
• begin_connection
• for each synchronization:• begin_synchronization
• receive and apply upload stream
• prepare and send download stream
• end_synchronization
• end_connection
• Scripts define actions performed at the consolidated database at each stage or event during synchronization
8.0 New Feature Highlights
• Last download timestamp
• Statement-based uploads
• Java synchronization logic
• Better remote ASA terminology
• Selective uploads (priority synchronization)
• Improved reporting
7.0 Download Cursor
• The download_cursor script is used to insert or update rows in the remote database
SELECT emp_id, emp_fname, emp_lname FROM employee WHERE last_modified > @LastDownload
• The download_deletes_cursor script is used to delete rows from the remote database
SELECT emp_id FROM employee WHERE last_modified > @LastDownload AND status = ‘INACTIVE’
8.0 Last Download Timestamp
• The download_cursor script is used to insert or update rows in the remote database
SELECT emp_id, emp_fname, emp_lname FROM employee WHERE last_modified > ?
• The download_deletes_cursor script is used to delete rows from the remote database
SELECT emp_id FROM employee WHERE last_modified > ? AND status = ‘INACTIVE’
Last Download Benefits
• Last download time automatically stored in remote ASA or UltraLite database and provided to scripts during subsequent upload
• Less reliance on RDBMS functionality• Performance
• Usability
• No longer need download ack• Immediate commit of download transaction
8.0 New Feature Highlights
• Last download timestamp
• Statement-based uploads
• Java synchronization logic
• Better remote ASA terminology
• Selective uploads (priority synchronization)
• Improved reporting
The upload_cursor Script
• The upload_cursor script is used to insert, update, or delete rows in the consolidated database
• This is the primary script for uploading changes
• Example:
SELECT emp_id, emp_fname, emp_lname FROM employee WHERE emp_id = ?
Statement-based Upload Scripts
• The upload_insert script is used to insert rows
DELETE FROM employee WHERE emp_id = ?
INSERT INTO employee (emp_id, emp_fname, emp_lname) VALUES ( ?, ?, ? )
• The upload_update script is used to update rows
UPDATE employee SET emp_fname = ?, emp_lname = ? WHERE emp_id = ?
• The upload_delete script is used to delete rows
Statement-based Conflicts
• The upload_fetch cursor for conflict detection
• The insert_old_row script is used to insert the row from the remote database before the update
• The insert_new_row script is used to insert the row from the remote database after the update
• The resolve_conflict script is used to resolve the conflict
Statement-based Benefits
• More understandable
• Array operations improve performance• Single statement with multiple parameter sets
• Stronger ODBC support
8.0 New Feature Highlights
• Last download timestamp
• Statement-based uploads
• Java synchronization logic
• Better remote ASA terminology
• Selective uploads (priority synchronization)
• Improved reporting
Java Synchronization Logic
• Synchronization scripts written in Java rather than the native language of the consolidated database
• Single Java class defines the synchronization logic for a complete synchronization
• One public method for each event (Java method replaces SQL script)
• Java methods are passed the same parameters as SQL scripts (table, user, last download)
• Different classes can be used for different versions
Java Synchronization Logic
R em oteD a tabase
M obiL ink
C onso lida tedD a tabase
O D B C
Java V MM obiL ink
JD B CB ridge
Java Details
• MobiLink Java API support classes
• Write your Java class and compile it
• Make your Java class available to MobiLink
• MobiLink runs Java synchronization logic in the standard Sun VM (JRE 1.3 installed)
• One instance of your class is instantiated for each MobiLink connection to the consolidated database
• One public method of your class is called for each event in the synchronization process
• Methods can return SQL strings
Java Example
public class SalesSync { private DBConnectionContect _cc; public SalesSync( DBConnectionContext cc ) { _cc = cc; } public String EmpDownload( String user, Timestamp ts ) { String sql = “SELECT emp_id, emp_fname, emp_lname ” + “FROM employee WHERE last_modified >= ‘” + ts + “’”; return sql; }}
Java Example
• javac -classpath c:\sa\java\mlscript.jar;.; Sales.java
• call ml_add_java_table_script( “Sales 1.0”, “employee”, “download_cursor”, “SalesSync.EmpDownload” )
• dbmlsrv8 -c “dsn=cons” -o out.txt -sl java {-classpath .;}
Java Flexibility
• MobiLink JDBC bridge allows access to the database connection MobiLink is using to synchronize data
• Ability to create additional connections to the consolidated database or to another database
• Java instance variables share data across events
• Java static variables share data across connections
• java.lang.system.out.println to MobiLink output log
• Full power of standard Java VM
• Can mix Java and SQL synchronization logic
Java Benefits
• Works around limitations in native procedural languages of RDBMS
• Allows synchronization logic to be more portable across multiple RDBMS products
• Well known mainstream language that is well suited to procedural logic
• Re-use business logic
• Better debugging tools available
8.0 New Feature Highlights
• Last download timestamp
• Statement-based uploads
• Java synchronization logic
• Better remote ASA terminology
• Selective uploads (priority synchronization)
• Improved reporting
7.0 ASA Client Terminology
• Reference database
• Synchronization template
• Synchronization site
• mlxtract.exe
• Synchronization definition
8.0 ASA Client Terminology
• Publication
• Synchronization user
• Synchronization subscription
CREATE PUBLICATION SalesSync ( TABLE employee );CREATE SYNCHRONIZATION USER sally TYPE ‘tcpip’ ADDRESS ‘host=SalesServer’;CREATE SYNCHRONIZATION SUBSCRIPTION TO SalesSync FOR sally;
New Terminology Benefits
• Simpler, easier to understand
• Closer to SQL Remote
• Groundwork for other new features• Multiple publications and subscriptions per user
• Selective uploads
• Use MobiLink to populate data
• Still a bit backwards
8.0 New Feature Highlights
• Last download timestamp
• Statement-based uploads
• Java synchronization logic
• Better remote ASA terminology
• Selective uploads (priority synchronization)
• Improved reporting
Selective Upload
• Multiple publications and subscriptions
• Publications can overlap
• ASA or UltraLite can synchronize one or more publications at the same time
• Articles in publications can identify a subset of the rows in a table using a WHERE clause
• ASA publications can identify a subset of the columns in tables (all publications must have same column list)
• UltraLite does not support column subsets
High Priority Synchronization
CREATE PUBLICATION SalesSyncHigh ( TABLE “order” WHERE priority = ‘high’, TABLE order_item i WHERE ‘high’ = (SELECT priority FROM “order” o WHERE o.id = i.id ) );CREATE PUBLICATION SalesSync ( TABLE employee, TABLE “order”, TABLE order_item );
Selective Upload Scenarios
• High priority wireless synchronization with lower priority cradle or LAN synchronization
• Nightly synchronization with more frequent synchronization throughout the day
• Request-based downloads
• Multiple applications using a common database
Selective Upload & Last Download
• Downloads have always been selective
• Separate last download timestamp kept for each publication in remote database• Each synchronization, MobiLink uses the earliest last
download time for all publications being synchronized
• Could mean redundant download
8.0 New Feature Highlights
• Last download timestamp
• Statement-based uploads
• Java synchronization logic
• Better remote ASA terminology
• Selective uploads (priority synchronization)
• Improved reporting
Improved Reporting
• New statistics events to record upload and download statistics (rows, errors, warnings, bytes)
• Upload dbmlsync output log following an error
• More detailed information following an error
More 8.0 New Features
• Automatic script generation
• sa_migrate
• Limit worker threads applying upload streams
• Database connection timeout
MobiLink Futures
• Message-based communication
• Java synchronization logic to non-relational enterprise application servers
• MobiLink monitor console
Resources Available
• Other TechWave sessions
• MySybase: Mobile & Wireless Developer• newsgroups, white papers, technotes, FAQs
• samples, patches
• Award winning technical support
• Training and assistance during the initial phases of your synchronization projects
iAnywhere Solutions Highlights
• Ask the Experts - about Mobile & Wireless Solutions-Mezzanine Level Room 15B Mon./Tues. 11:30 am - 3:30 pm; Wed. 11:30 - 1:30;Thurs. 9 am - 12 noon-Exhibit Hall - Demo Center (truck) exhibit hall hours
• SIG (Special Interest Group)- Tuesday 5:30pm Mobile & Wireless SDCC, Upper level, Room 11
• Keynote - Enabling m-Business SolutionsWednesday 1:30 pm - 3:00 pm
• iAnywhere Solutions Developer Community-Excellent resource for commonly asked questions, newsgroups, bugfixes, newsletters, event listings - visit www.ianywhere.com/developer