To execute a SQL language statement to the DB2 access service through a SQL Server RPC, use the following 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.
The DB2 access service RPC event handler is sensitive to several key RPC names. In this case, the RPC keyword dcon is a special name that DirectConnect 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.
For backward compatibility with the MDI Database Gateway, pcsql is recognized in place of the dcon keyword. For backward compatibility with Net-Gateway, syrt is recognized in place of the dcon keyword.
To execute a language statement as an RPC:
Adaptive Server determines if the remote server (in this case, directconnect) is configured as a remote server to Adaptive Server.
If the remote server is not configured, the request fails immediately.
If the remote server is configured, Adaptive Server checks for a site handler connection to the remote server.
Adaptive Server does one of the following:
If a site handler connection exists, Adaptive server connects to the remote server, triggering a connect event at the DirectConnect. If the connect event processes successfully, Adaptive Server triggers an RPC event at DirectConnect 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, Adaptive Server establishes one. This connection exists for the life of the RPC and is reused when Adaptive Server submits other RPCs.
Copyright © 2005. Sybase Inc. All rights reserved. |