Binding a Mobile Business Object to a Database

Bind the attributes and operations of a mobile business object to a database object.

Prerequisites  Create the mobile business object (MBO).
  1. Open the MBO that you want to bind to a database object.
  2. In the Mobile Application Diagram, right-click the MBO, and select Detailed Properties.
  3. In the Mobile Business Object Properties dialog, select the General tab, and verify that the Syncable property is checked.
  4. Select the Connection tab, then define the connection details:
    1. Click Select to the right of the Connection field.
    2. Select Define Connection Now.
    3. Select Database as the Connection Type.
    4. For the Connection Name, either select the name of an existing database connection, or click New and create a new connection. Click OK.
    5. Select either:
      • Use Default Authentication, or
      • Override Default Authentication – next, enter the authentication details.
      Note: Using default authentication, data-source connections are pooled. If you override default authentication, data-source connections are created when they are needed, then released.
  5. To specify the database table columns that define the MBO attributes, select the Definition tab, then choose either:
    • Generate SQL query from the selections – next, select the database columns to use in the SQL query. The SQL query is generated automatically, and appears at the bottom of the window.

      Note: When you drag and drop from a database column to create a Create operation and the column has a key column that is autoincrement, the SQL query that is generated returns the new row.

      Example for a Sybase database: Appending a SELECT statement to the form Select*FROM<tableName>WHERE <identityColumnName> = @@identity

      This enables the multi-level insert feature functionality.

    • Define the SQL query manually – next, click Visual SQL to start the Visual SQL Designer.

      If you expect remote-device users to supply column values, configure your SELECT statement similar to the following, in which we expect users to supply their first and last names:
      SELECT * FROM Customer WHERE firstName = '@OP["fname"=""]' && lastName = '@OP["lname"=""]'
      

      To check whether the SQL is valid, click Validate Syntax.

    Note: If you enter SQL manually, then choose to generate the SQL automatically, the SQL that was entered manually is overwritten.
    To see the results of the SQL query, click Preview Data.
  6. Map the MBO attributes to database (data source) columns.
  7. To map MBO parameters to database arguments, select the Parameters tab.

    For each parameter, specify:

    Option Description
    Name Parameter name.
    Note: Parameter names cannot contain C# or Java reserved words.
    Datatype Parameter datatype.
    Default Value Default parameter value.
    Argument Database argument name.
    Datatype Datatype of the database argument.
    Default Value Default argument value.
    Filter By Define the argument as a field that can be used to filter the results that are downloaded to mobile devices.
    Personalization Key If you select Filter By, you can select a personalization key to map to the argument, which provides an argument value.
  8. On the Summary page, review the MBO configuration. To save the values and exit, click Finish. To change values, click Previous to go back to the configuration page.
Related concepts
Connection Pools


Created September 17, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com