Executing a language statement as an RPC

The DB2 access service RPC event handler is sensitive to several key RPC names. In this example, the RPC keyword dcon is a special name that DirectConnect for z/OS Option recognizes. As a result, the DB2 access service translates the first parameter into a dynamic SQL statement, submits it to the target database, and then returns the result set to the client application.

StepsTo execute a SQL language statement through an ASE RPC

  1. Use this syntax:

    C:> isql -Ssqlserver -Uuser -Ppassword
     1> execute directconnect...dcon “select * from
     	user.authors”
     2> go
    

    where:

    • directconnect is the name of the remote server. The three periods (. . .) following directconnect are required.

    • dcon is the special name, or keyword, of the RPC.

  2. ASE determines if the remote server (in this case, directconnect) is configured as a remote server to ASE.

    • If the remote server is not configured, the request fails immediately.

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

      • If a site handler connection exists, ASE connects to the remote server, triggering a connect event at DirectConnect z/OS Option. If the connect event processes successfully, ASE triggers an RPC event at DirectConnect z/OS Option and submits the RPC dcon. The first parameter to the RPC is the dynamic SQL language statement that is executed.

      • If a site handler connection does not exist, ASE establishes one. This connection exists for the life of the RPC and is reused when ASE submits other RPCs.