This is an example of how to execute a SQL language statement to the access service through an RPC:
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 following directconnect are required.
dcon is the keyword of the RPC.
WARNING! When using the keyword dcon, the access service will insert a space between each variable.
The access service RPC event handler is sensitive to several RPC keywords, including the keyword dcon used in this example. 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 as follows:
ASE 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, ASE checks for a site handler connection to the remote server.
ASE does one of the following:
If the site handler connection exists, ASE connects to the remote server, triggering a connect event in the DirectConnect server.
If the connect event processes successfully, ASE 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, ASE establishes one.
This connection exists for the term of the RPC. It is reused if ASE submits other RPCs.