Defining a default SQL language handler  Adaptive Server stored procedure example

Chapter 3: Configuring a TRS

Defining multiple SQL language handlers

To send SQL language requests to more than one language RPC (that is, if you have copies of MainframeConnect for DB2 UDB or OmniSQL Access Module for DB2 in other regions), define multiple language handlers, each with a different RPC name and a different region name. Clients can explicitly specify the particular language RPC in the request.

Add the alternate language handlers using the sgw_addrpc procedure, using the following parameter values:

The following isql example shows three procedures that define different RPCs for the AMD2 transactions at the DALLAS, DETROIT, and MIAMI regions, respectively. This example allows a user to specify the region to which TRS sends the language request: DALLASrpc uses the DALLAS region, DETROITrpc uses the DETROIT region, and MIAMIrpc uses the MIAMI region.

exec sgw_addrpc DALLASrpc, AMD2, DALLAS, both
 go
exec sgw_addrpc DETROITrpc, AMD2, DETROIT, both
 go
exec sgw_addrpc MIAMIrpc, AMD2, MIAMI, both
 go

If security is enforced, add the preceding RPCs to the appropriate tran_group that the tran_group users can access.

For example:

exec sgw_addrpctogrp TRANGRP2, DALLASrpc, user
go
exec sgw_addrpctogrp TRANGRP2, DETROITrpc, user
go
exec sgw_addrpctogrp TRANGRP2, MIAMIrpc, user
go

To obtain results from TESTREG with SYRT as the default (using the “Example”), a user invokes a SQL query program, such as isql, and enters a query similar to the following:

select * from payroll
go

To obtain results from MIAMI, a user enters the following execute command, specifying the RPC named MIAMIrpc:

exec MIAMIrpc "select * from payroll"
go




Copyright © 2005. Sybase Inc. All rights reserved. Adaptive Server stored procedure example

View this book as PDF