Executing a Language Statement as an RPC

Execute a SQL language statement to the access service through an RPC.

  1. Connect to Adaptive Server using isql.
  2. At the prompt, enter:
    C:> isql -Sadaptiveserver -Uuser -Ppassword
     1> execute directconnect. . .dcon “select * from user.authors”
     2> go
    where:
    • directconnect is the name of the remote server. The three periods (...) after directconnect are required.

    • dcon is the keyword of the RPC.

      Warning!  When using the keyword dcon, the access service inserts a space between each variable.

    The access service RPC event handler is sensitive to several RPC keywords, including the keyword dcon. An RPC can have many parameters. Before the resulting string is executed, all parameters are concatenated. The access service translates the first parameter into a dynamic SQL statement, submits it to the target database, and returns the result set to the client application.

    The event sequence is:

    1. Adaptive Server determines whether the remote server directconnect is configured as a remote server:
      • If the remote server is not configured correctly, the request fails.

      • If the remote server is configured correctly, Adaptive Server checks for a site handler connection to the remote server.

    2. Adaptive Server checks:
      • If the site handler connection exists, then Adaptive Server connects to the remote server, triggering a connect event in the DirectConnect server.

      • If the connect event processes successfully, then Adaptive Server triggers an RPC event in the DirectConnect server and submits the RPC called dcon. The first parameter to the RPC is the dynamic SQL language statement that is executed.

      • If the site handler connection does not exist, then Adaptive Server establishes one.

    This connection exists for the term of the RPC. It is reused if Adaptive Server submits other RPCs.