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

SQL Anywhere 10.0.1 » MobiLink - Getting Started » Tutorial: Using .NET and Java for custom authentication

Lesson 1: Create a Java or .NET class for custom authentication (server-side) Next Page

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


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.

MobiLink database sample

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.

CustDB is designed to be a consolidated database server for both UltraLite and SQL Anywhere clients. The CustDB database has a DSN called SQL Anywhere 10 CustDB.

To register the authenticateUser method for the authenticate_user event
  1. Connect to the sample database using Interactive SQL.

    At a command prompt, type:

    dbisql -c "dsn=SQL Anywhere 10 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 command in Interactive SQL:

    call ml_add_java_connection_script(
    'custdb 10.0',
    'authenticate_user',
    'MobiLinkAuth.authenticateUser');
    commit;

    For .NET, execute the following command in Interactive SQL:

    call ml_add_dnet_connection_script(
    'custdb 10.0',
    'authenticate_user',
    'MobiLinkAuth.authenticateUser');
    commit;
  3. In the next lesson, you start the MobiLink server and load your class file or assembly.

    Further reading

    For general information about adding and deleting synchronization scripts, see Adding and deleting scripts.

    For more information about the ml_add_java_connection_script, see ml_add_java_connection_script

    For more information about the ml_add_dnet_connection_script, see ml_add_dnet_connection_script.