Authentication

The generated package database class already provides a valid synchronization connection profile. You can log in to the Unwired Server with your user name and credentials.

The package database class provides the following methods for logging in to the Unwired Server:

onlineLogin authenticates the credentials against the Unwired Server.

offlineLogin authenticates against the last successfully authenticated credentials. There is no communication with Unwired Server in this method.

loginToSync tries offlineLogin first. If offlineLogin fails, it will try onlineLogin. This is the recommended login method. loginToSync brings the KeyGenerator to the client from the Unwired Server. The KeyGenerator is an MBO for storing key values that are known to both the server and the client. On loginToSync from the client, the server sends down a value that the client can use when creating new records (by using the method [KeyGenerator generateId] to create key values that the server will accept).

The KeyGenerator is set up so that the value increments each time the generateId method is called. A periodic call to submitPending by the KeyGenerator generateId MBO sends the most recently used value to the Unwired Server, to let the Unwired Server know what keys have been used on the client side.

<PkgName>DB.loginToSync("username", "password");
Note: Call loginToSync at least once before using the specific Sybase Unwired Platform package.