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

SAP Sybase SQL Anywhere 16.0 » MobiLink - Getting Started » MobiLink tutorials » Tutorial: Using central administration of remote databases


Lesson 17: Querying the remote database

In this lesson, you query the remote database and return results to the server. This is very useful when troubleshooting because you can find out exactly what state the remote database is in.


This lesson assumes you have completed all preceding lessons. See Lesson 1: Creating a consolidated database.

This lesson assumes you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Using central administration of remote databases.

Contexte et remarques

The tables you have added to the database in this tutorial do not contain any data, so instead you query the database system tables. Even though you are querying a system table in this example, everything you do works exactly the same way as if you queried a user table.

Suppose that you wanted to confirm that the schema change you performed in the last lesson did what you expected, that the product table was created with the correct columns. You could confirm that by querying the systable and systabcol system tables.

  1. In the Folders view of Sybase Central under MobiLink 16, expand Central Admin Tutorial, right-click Remote Tasks and click New » Remote Task.

    The Create Remote Task Wizard appears.

  2. On the Welcome page, type Table Query in the Name field.

  3. Check This task requires or creates a remote database and set the Remote schema name to Tutorial Application v2.0 and click Next.

  4. On the Trigger Mechanisms page, check When it is received by an agent and click Finish.

  5. Add an Execute SQL command to the task with the following SQL:

    SELECT * FROM systable WHERE table_name = 'product'
    SELECT * FROM systabcol ORDER BY table_id
  6. Right-click the new Table Query task and click Deploy. Click Next.

  7. For Recipients, choose Specific agents, select agent AID_JOHN and click Next and then click Next again.

  8. On the Reporting Results And Status page, set both If task succeeds and If task fails to Send results and status immediately. Click Finish and wait until the task executes.

  9. Click the deployed copy of the Table Query task in the Folders view and then click the Results tab. If you don't see any results on the tab, wait until the tab is automatically refreshed or press F5 to refresh immediately.

  10. Right-click the line in the table for the Execute SQL statement and choose Details.

    The Command Result window appears.

  11. Click the Results tab on the window. This tab shows results of any queries executed. The Result dropdown at the top of the pane allows you to switch between results for the two queries. Click Close.


The results from the remote database are displayed.