Lesson 2: Registering your Java or .NET scripts for the authenticate_user event

This lesson assumes you have completed all preceding lessons. See Lesson 1: Creating a Java or .NET class for custom authentication (server-side).

SQL Anywhere ships with a SQL Anywhere sample database (CustDB) that is already set up for synchronization. The CustDB ULCustomer table, for example, is a synchronized table supporting a variety of table-level scripts. In this lesson, you register the MobiLinkAuth authenticateUser method for the authenticate_user synchronization event. You add this script to CustDB, the MobiLink sample database.

CustDB is designed to be a consolidated database server for both UltraLite and SQL Anywhere clients. The CustDB database has an ODBC data source named SQL Anywhere 12 CustDB.

 Register the authenticateUser method for the authenticate_user event
  1. Connect to the sample database from Interactive SQL.

    Run the following command:

    dbisql -c "DSN=SQL Anywhere 12 CustDB"
  2. Use the ml_add_java_connection_script or ml_add_dnet_connection_script stored procedure to register the authenticateUser method for the authenticate_user event.

    For Java, execute the following SQL statements:

    CALL ml_add_java_connection_script(
        'custdb 12.0',
        'authenticate_user',
        'MobiLinkAuth.authenticateUser');
    
    COMMIT;

    For .NET, execute the following SQL statements:

    CALL ml_add_dnet_connection_script(
        'custdb 12.0',
        'authenticate_user',
        'MobiLinkAuth.authenticateUser');
    
    COMMIT;
  3. Proceed to Lesson 3: Starting the MobiLink server.

 See also