Enterprise J2ME Developing Mobile Java Applications [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Enterprise J2ME Developing Mobile Java Applications [Electronic resources] - نسخه متنی

Michael Juntao Yuan

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید



13.4 iAnywhere Solutions MobiLink


MobiLink is the synchronization engine in iAnywhere Solutions' SQL Anywhere Studio (v8.0, see Chapter 11, Section 11.7). It synchronizes iAnywhere Adaptive Server Anywhere and UltraLite mobile databases with enterprise databases, including Oracle, IBM DB2, Microsoft SQL, and Sybase Adaptive Server Enterprise. Important features of MobiLink are the following:

Flexible synchronization logic through user-defined sync scripts.

The synchronization script is written for and stored in the enterprise database, which allows developers to use SQL dialects that they are already familiar with.

Multiple communication protocols are supported for synchronization streams. Those protocols include TCP/IP, HTTP, and direct serial line.

Each synchronization operation is a transaction with guaranteed integrity.

Adjustable parameters (such as cache size, maximum number of threads) for performance tuning.

Strong security through user authentication and 128-bit encrypted synchronization data streams.



13.4.1 MobiLink via Standalone Native Clients


MobiLink can be manually invoked by native clients on devices. We go through the following steps to complete a synchronization cycle.


Create a synchronization username and password through the Sybase Central administration panel.

In the Sybase Central administration panel's MobiLink plug-in, select tables that are available for synchronization from backend databases.

Write SQL scripts for each sync event. For example, an upload_insert event might trigger a simple SQL INSERT statement, while a download_cursor event might trigger an SQL SELECT statement. We can skip this step and use the default scripts if there is no custom synchronization logic.

On the remote (mobile) database, create a publication containing tables to synchronize using the statement CREATE PUBLICATION.

On the remote database, create a user and associate a publication with the user through a subscription. Related statements are CREATE SYNCHRONIZATION USER and CREATE SYNCHRONIZATION SUBSCRIPTION. The subscription also contains the synchronization server address and the data communication protocol (e.g., TCP/IP, HTTP, or serial link).

Run the remote sync client.


Note

The concepts of publication and subscription in Sybase MobiLink is different from other synchronization engines.


13.4.2 Access MobiLink Programmatically


The MobiLink synchronization client can be invoked as a command-line utility. But for autogenerated UltraLite databases, the MobiLink API is already built in. The following code snippet (Listing 13.5) demonstrates how to synchronize the entire clientside Java UltraLite database.

Listing 13.5. Using MobiLink



UlSynchOptions synch_opts = new UlSynchOptions();
synch_opts.setUserName( "userid" );
synch_opts.setPassword( "passwd" );
synch_opts.setScriptVersion( "default" );
// We use TCP/IP socket as the sync transport.
synch_opts.setStream( new UlSocketStream() );
synch_opts.setStreamParms( "host=192.128.10.1" );
((JdbcConnection) conn) synchronize( synch_opts );

If you have a homogeneous environment containing only iAnywhere databases, Sybase has another synchronization product called SQL Remote. SQL Remote supports message-based asynchronous operation and is therefore scalable. Interested readers should refer to iAnywhere documentation for that technology.


/ 204