Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » UltraLite - Database Management and Developer Guide » UltraLite database reference » UltraLite utilities

UltraLite Synchronization utility (ulsync)

Synchronizes an UltraLite database with a MobiLink server. This tool can be used for testing synchronization during application development.

Syntax
ulsync [ options ]  [synchronization-parameters]
Option Description
@ data Use this to read in options from the specified environment variable or configuration file. If both exist with the same name, the environment variable is used.

-c "connection-string"

or

--connect="connection-string"

Required. Connect to the database as identified in the DBF or file_name parameter of your connection-string. If you do not specify both a user ID and a password, the default UID of DBA and PWD of sql are assumed.

-p profile-name

or

--profile=profile

Synchronize using the named synchronization profile, equivalent to:

SYNCHRONIZE profileName MERGE syncOptions

where sync options are taken from the trailing ulsync options. For example:

ulsync -p profileName "MobiLinkUid=ml;ScriptVersion=Version001...syncOptions"

-q

or

--quiet

Set the utility to run in quiet mode. Suppress informational banners, version numbers, and status messages. Error messages are still displayed, however.

-r

or

--result

Display last synchronization results and exit.

-v

or

--verbose

Display synchronization progress messages. This also determines whether progress is displayed for any synchronization, whether using the C++ API or the SQL SYNCHRONIZE PROFILE statement.
--log=filename Log operations to the specified file.

-?

or

--help

Display utility usage information and exit.
Remarks

Your certificate may be bundled with your application by including it in the Xcode project. If you specify the bare name plus extension for a certificate file option, UltraLite will automatically look in the bundle to find it. If you want, you can specify a full path.

The following options that were valid for versions 10 and earlier are no longer supported: -a authenticate-parameters, -e sync-parms, -k stream-type, -n (no sync), and -x protocol options. -e keyword=value is now part of the sync parameters string and -k and -x are now part of the Stream= stream{stream-parms} sync parameters string.

Below, we show a ulsync example and the equivalent SQL statement.

ulsync -p profile "parms"

This command is equivalent to the following SQL statement.

SYNCHRONIZE PROFILE profile MERGE parms

The following is another example.

ulsync "parms"

This command is equivalent to the following SQL statement.

SYNCHRONIZE USING parms

For secure synchronization, the UltraLite application must have access to the public certificate. You can reference a certificate by:

  • Incorporating the certificate information into the UltraLite database at creation time with the -t file option using ulinit or ulload.

  • Referencing an external certificate file at synchronization time with the trusted_certificate= file stream option.

This utility returns error codes. Any value other than 0 means that the operation failed.

Example

The following command synchronizes a database file called myuldb.udb for a MobiLink user called remoteA.

ulsync -c DBF=myuldb.udb "MobiLinkUid=remoteA;Stream=http;ScriptVersion=2"

The following command synchronizes a database file called myuldb.udb over HTTPS with the C:\Users\Public\Documents\SQL Anywhere 17\Samples\Certificates\rsaroot.crt certificate. The trusted_certificate= file option must be used because the trusted certificate file was not added to the database when the database was created. Additionally, the MobiLink user name is remoteB.

ulsync -c DBF=myuldb.udb "Stream=https{trusted_certificate=C:\Users\Public\Documents\SQL Anywhere
         17\Samples\Certificates\rsaroot.crt};MobiLinkUid=remoteB;ScriptVersion=2;UploadOnly=ON"

The following command displays the last synchronization results for a database file named synced.udb.

ulsync -r -c dbf=synced.udb

The previous synchronization results are listed as follows:

SQL Anywhere UltraLite Synchronization Utility Version 17.0.4.1691
    Results of last synchronization:
    Succeeded
        Download timestamp: 2006-07-25 16:39:36.708000
        Upload OK
        No ignored rows
        Partial download retained
        Authentication value: 1000 (0x3e8)

The following example shows the command line used to synchronize the CustDB database with a user name of 50 over TCP/IP on a port of 2439. It uses verbose progress messages.

ulsync -c "dbf=C:\Users\Public\Documents\SQL Anywhere
         17\Samples\UltraLite\CustDB\custdb.udb" "MobiLinkUid=50;ScriptVersion=custdb 17.0.4;Stream=tcpip{port=2439}"

The following command illustrates how to use TLS encryption with end-to-end encryption (E2EE):

ulsync -c "uid=dba;pwd=sql;dbf=myudb.db" "MobiLinkUid=rem1;MobiLinkPwd=password;ScriptVersion=v1;Stream=tls{host=myServer;port=2439;trusted_certificate=clientcert.pem;e2ee_public_key=e2eepublic.pem}"