Professional Documents
Culture Documents
Mls QL Server Tut
Mls QL Server Tut
Contents
Synchronizing Microsoft SQL Server with MobiLink Introduction Required Software MobiLink Quick Start Set up the Microsoft SQL Server consolidated database Set up the remote Adaptive Server Anywhere database Create scripts to upload and download data . . . . . . . Run MobiLink synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 3 3 3 3 3 4 4 4 6 9 9 11 11
MobiLink Synchronization to a Microsoft SQL Server Database in 30 Minutes Set up the Microsoft SQL Server consolidated database . . . . . . . . . . Set up the remote Adaptive Server Anywhere database . . . . . . . . . . Starting the MobiLink synchronization server . . . . . . . . . . . . . . . . Running the MobiLink synchronization client utility . . . . . . . . . . . . . Legal Notice Contact Us . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction
MobiLink enables synchronization between a central ODBC-compliant consolidated database and many Adaptive Server Anywhere or UltraLite remote databases. MobiLink synchronization is a component of SQL Anywhere Studio, iAnywhere Solutions comprehensive package for mobile data management. The following diagram shows the major parts of the synchronization system.
network
ASA
consolidated database This database contains the central copy of all information in the synchronization system. consolidated database server The server, or DBMS, that manages the consolidated database. This server can be one of the following ODBC-compliant databases: Adaptive Server Anywhere, Adaptive Server Enterprise, Oracle, IBM DB2, or Microsoft SQL Server. In this tutorial the consolidated database server is SQL Server. ODBC connection All communication between the MobiLink synchronization server and the consolidated database occurs through an ODBC connection. ODBC allows the synchronization server to utilize a variety of consolidated database systems. In this tutorial, the ODBC connection is made with the SQL Server ODBC driver. MobiLink synchronization server This server, dbmlsrv9, manages the
Copyright 2004 iAnywhere Solutions, Inc. synchronization process and provides the interface between all MobiLink clients and the consolidated database server. network The connection between the MobiLink synchronization server and the MobiLink client (dbmlsync or UltraLite) can use a number of network protocols. This tutorial uses the TCP/IP protocol. MobiLink client The client can be installed on a handheld device such as a Palm Pilot or Pocket PC, a server or desktop computer, or an embedded device such as a cell phone or vending machine. Two types of clients are supported: Adaptive Server Anywhere (used in this tutorial) and UltraLite. Either or both may be used in a single MobiLink installation.
Required Software
A full SQL Anywhere Studio 9.0.1 installation. A full installation of SQL Server 2000 including the Northwind sample database.
Copyright 2004 iAnywhere Solutions, Inc. How data uploaded from the remote database is to be applied to the consolidated database. What data should be downloaded from the consolidated database. These scripts may be individual statements or stored procedure calls stored in your consolidated database. For simple cases you can instruct the MobiLink synchronization server to generate scripts automatically at runtime using a command-line option.
Copyright 2004 iAnywhere Solutions, Inc. Choose Start Programs Microsoft SQL Server Query Analyser. 2. Select the Northwind sample database. From the DB dropdown menu in the toolbar, choose Northwind. 3. Execute the SQL script. Open syncmss.sql: From the File menu, choose Open. Now select syncmss.sql, located in the MobiLink\setup subdirectory of your SQL Anywhere installation. Press F5 to execute the Query. Dene an ODBC data source for the consolidated database Use the Microsoft SQL Server ODBC driver to dene an ODBC data source for the Northwind sample database. y To dene an ODBC data source for the consolidated database 1. Start the ODBC Administrator: Fromt the Start menu, choose Programs SQL Anywhere 9 Adaptive Server Anywhere ODBC Administrator. The ODBC Data Source Administrator appears. 2. On the User DSN tab, click Add. The Create New Data Source dialog appears. 3. Select SQL Server and click Finish. The Microsoft SQL Server DSN Conguration wizard appears. 4. Enter sqlserver_consolidated as the Name of the data source. Click Next to continue. 5. On the next page, select the appropriate authentication mode for your SQL connection. Click Next to continue. 6. Select Northwind as the default database. Remove check marks from the following: Use ANSI quoted identiers. Use ANSI nulls, paddings and warnings. 7. Accept the remaining default settings and click Finish. Synchronization scripts In this tutorial, you do not manually add synchronization scripts. When you start the MobiLink synchronization server with special command-line options, default scripts are automatically generated. You can use these scripts as a starting point for generating your own scripts. Setup for the Microsoft SQL Server consolidated database is now complete.
Migrating a subset of the Northwind database Microsoft SQL Server schema Migrating a subset of the Northwind schema involves: Connecting to the remote database. Creating a remote server and external login. Using the Sybase Central Data Migration wizard. y To migrate a subset of your Microsoft SQL Server schema to the Adaptive Server Anywhere database 1. Start Sybase Central. From the Start menu, choose Programs SQL Anywhere 9 Sybase Central. 2. Connect to the remote database: Select Adaptive Server Anywhere 9 in the left pane of Sybase Central. From the File menu choose Connect. The Connect dialog appears. On the Identication tab, enter DBA as the User ID and SQL as the password. On the Database tab, enter remote1 as the server name. Click OK to connect. 3. Create a remote server and external login: Start the Remote Server Creation wizard. In the left pane, select the Remote Servers folder. From the File menu choose New Remote Server. The Remote Server Creation wizard starts.
Copyright 2004 iAnywhere Solutions, Inc. Name the remote server my_sqlserver. Click Next to continue. Choose Microsoft SQL Server as the type of server. On the next page of the wizard, enter sqlserver_consolidated in the connection information section. On the nal page of the wizard, choose Create an External Login. Enter the Login name and Password to connect to your Microsoft SQL Server instance. Click Finish to exit the Remote Server Creation wizard. 4. Migrate the Microsoft SQL Server schema: In the left pane, select the Adaptive Server Anywhere 9 plug-in. In the right pane, select the Utilities tab and double-click Migrate Database:
The Data Migration wizard starts. Select remote1 as the destination database. On the next page, select my_sqlserver as the remote server. Click Next to continue. Choose Customers and Employees as the only tables to migrate.
On the nal page of the wizard, clear the Migrate the data option:
Click Finish. The migration of the Microsoft SQL Server schema is now complete. y To create a remote synchronization publication, synchronization user, and synchronization subscription 1. Start Interactive SQL: In the left pane of Sybase Central, select the remote1 database. From the File menu choose Open Interactive SQL. The Connect dialog appears. 2. Enter synchronization information: Execute the following commands in Interactive SQL:
CREATE PUBLICATION sample_pub (TABLE Customers, TABLE Employees); CREATE SYNCHRONIZATION USER ml_user1; CREATE SYNCHRONIZATION SUBSCRIPTION TO sample_pub FOR ml_user1 TYPE TCPIP ADDRESS host=localhost OPTION scriptversion=ver1;
Now you have prepared the remote and consolidated databases and can begin with the synchronization process.
Note: MobiLink technology also allows you to obfuscate command-line options in a command le. Consult MobiLink documentation about the dbfhide utility for more information. The following table describes each option used with the dbmlsrv9 utility. The options -o, -v, and -dl provide debugging and troubleshooting information. Using these logging options is appropriate in a development environment. For performance reasons, -v and -dl are typically not used in production.
Option -c -o -v+ -dl -za Description Precedes the connection string. Species the message log le serverOut.txt. The -v option species what information is logged. Using -v+ sets maximum verbose logging. Displays all log messages on screen. Turns automated scripting ON. The -za option is typically used to generate scripts as a starting point for writing your own scripts. Scripts are generated the rst time that a remote synchronizes. If the given script version already exists, -za has no effect. Adds new users automatically. Sets the communications protocol and parameters for MobiLink clients.
-zu+ -x
A dialog appears to indicate the MobiLink synchronization server is ready to handle requests:
Copyright 2004 iAnywhere Solutions, Inc. y To start the synchronization client 1. At a command prompt, type the following on a single line:
dbmlsync -c "eng=remote1;uid=dba;pwd=sql" -o rem1.txt -v+ -e "SendColumnNames=on"
Once you have started the MobiLink synchronization client, an output screen appears indicating that the MobiLink synchronization succeeded. The data in the Microsoft SQL Server tables now appears in your Adaptive Server Anywhere database. You can check that synchronization has succeeded by checking row values in the remote database. y To check row values on the remote database 1. Open Sybase Central and connect to the remote1 database using the Adaptive Server Anywhere 9 plug-in (if not already connected). 2. Open the Tables folder and choose the Employees Table. On the right pane, select the Data tab. Data downloaded from the Microsoft SQL Server consolidated database appears:
10
Legal Notice
Copyright 2004 iAnywhere Solutions, Inc. All rights reserved. Sybase, the Sybase logo, iAnywhere Solutions, the iAnywhere Solutions logo, Adaptive Server, MobiLink, and SQL Anywhere are trademarks of Sybase, Inc. or its subsidiaries. All other trademarks are property of their respective owners. The information, advice, recommendations, software, documentation, data, services, logos, trademarks, artwork, text, pictures, and other materials (collectively, Materials) contained in this document are owned by Sybase, Inc. and/or its suppliers and are protected by copyright and trademark laws and international treaties. Any such Materials may also be the subject of other intellectual property rights of Sybase and/or its suppliers all of which rights are reserved by Sybase and its suppliers. Nothing in the Materials shall be construed as conferring any license in any Sybase intellectual property or modifying any existing license agreement. The Materials are provided AS IS, without warranties of any kind. SYBASE EXPRESSLY DISCLAIMS ALL REPRESENTATIONS AND WARRANTIES RELATING TO THE MATERIALS, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. Sybase makes no warranty, representation, or guaranty as to the content, sequence, accuracy, timeliness, or completeness of the Materials or that the Materials may be relied upon for any reason. Sybase makes no warranty, representation or guaranty that the Materials will be uninterrupted or error free or that any defects can be corrected. For purposes of this section, Sybase shall include Sybase, Inc., and its divisions, subsidiaries, successors, parent companies, and their employees, partners, principals, agents and representatives, and any third-party providers or sources of Materials.
Contact Us
iAnywhere Solutions Worldwide Headquarters One Sybase Drive, Dublin, CA, 94568 USA Phone 1-800-801-2069 (in US and Canada) Fax 1-519-747-4971 World Wide Web http://www.ianywhere.com E-mail contact.us@ianywhere.com
11