Scalable Database Server, HiRDB Version 8 UAP Development Guide
This section explains use of the default SQL connection as the current SQL connection for accessing a remote database.
When the default SQL connection is used as the current SQL connection, it is possible to access the databases of all distributed RD-nodes that can be connected to the default RD-node. To do this, it is necessary to use one of the following methods to notify the default RD-node's HiRDB of the distributed RD-node where the table and procedure to be accessed are located:
Methods (a) and (c) can also be used when a table or procedure located at the default RD-node is to be accessed. In such a case, the name is qualified with the RD-node name of the default RD-node. Tables or procedures whose names are not modified by an RD-node name are processed under the assumption that they are located at the current RD-node.
Use of the default SQL connection also enables access to the database of a distributed RD-node. However, the following restrictions apply:
The following format is used to qualify the table name with the RD-node name:
RD-node-name.authorization-identifier.table-identifier
SELECT * FROM RDNODE10.MANAGER.ORDERS
The following format is used to specify the table at a distributed RD-node using a table alias. Note that a table alias is not supported if either the distributed server or the distributed client is Solaris.
[authorization-identifier.]table-alias
CREATE ALIAS MANAGER.ORDERS FOR RDNODE10.MANAGER.ORDERS
SELECT * FROM MANAGER.ORDERS
The following format is used to qualify the procedure name with the RD-node name:
RD-node-name.authorization-identifier.routine-identifier
CALL RDNODE10.MANAGER.PROC10 (arguments)
Even when the default SQL connection is used, an SQL connection to a distributed RD-node is required for accessing a remote database. If the UAP issues an SQL for accessing a remote database without creating an SQL connection, the HiRDB at the default RD-node generates automatically an SQL connection to the distributed RD-node.
However, because the SQL connection generated automatically by the HiRDB contains the same authorization identifier as the default SQL connection, the remote database cannot be accessed if that authorization identifier does not have the required privilege at the distributed RD-node. In such a case, it is possible to create an SQL connection that contains an authorization identifier that has the required privilege at the distributed RD-node in advance and then to use that SQL connection.
CONNECT TO RDNODE10 USER:USER2 USING :PSWD2SET CONNECTION DEFAULTSELECT SQUANTITY INTO :QUANTITY FROM RDNODE10.MANAGER.STOCK WHERE PCODE='302S'
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.