IBM Support

RDB alias support for 3-part SQL statements

News


Abstract

RDB alias support for 3-part SQL statements

Content

You are in: IBM i Technology Updates > Db2 for i - Technology UpdatesDb2 for i Functional Enhancements > RDB alias support for 3-part SQL statements

As an alternative to using the CREATE ALIAS SQL statement to deploy database transparency, the Relational Database Directory Entry Alias name can be used.
To do this, the SQL statement would be coded to refer to the RDB directory entry alias name as the first portion (RDB target) of a three part name.  
By changing the RDB directory entry to have a different destination database via the Remote location (RMTLOCNAME) parameter, the SQL application can target a different database without having to change the application.
Example – pull daily sales data from different destinations
ADDRDBDIRE RDB(X1423P2 MYALIAS) RMTLOCNAME(X1423P2 *IP)
INSERT INTO WORKTABLE SELECT * FROM MYALIAS.SALESLIB.DAILY_SALES

CHGRDBDIRE RDB(LP13UT16 MYALIAS) RMTLOCNAME(LP13UT16 *IP)
INSERT INTO WORKTABLE SELECT * FROM MYALIAS.SALESLIB.DAILY_SALES

Figure 1. Effect of redefining an RDB alias target

image-20200115130519-1

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Component":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
15 January 2020

UID

ibm11167286