DB2 Hooks and Environment Variables (KBA4047)
KBA
KBA# 4047DB2 Environment Variables
Operations that run user-provided scripts have access to environment variables. For operations associated with specific dSources or virtual databases (VDBs), the Delphix Engine will always set environment variables so that the user-provided operations can use them to access the dSource or VDB.
dSource Environment Variables |
|
Environment Variable | Description |
DLPX_DATA_DIRECTORY |
Path where staging database is mounted |
VDB Environment Variables |
|
DLPX_DATA_DIRECTORY |
Path where virtual database is mounted |
The commands which are supposed to run through hooks will have access to the user's environment variables which are being used for executing the hook. In addition to the user’s environment variables, hooks will also have access to dSource/VDB environment variables as well.
The following example checks the environment variables that are accessible to Hooks.
-
Create a Pre-Sync Hook.
Name it as testEnvDisplay in dSource configurations. -
Add below content:
# Capture environment variables
env > /tmp/envVariablesList.log
-
Take a snapshot and check file /tmp/envVariablesList.log.
This will display all environment variables including DLPX_DATA_DIRECTORY.
Frequently Asked Questions
When you run Hooks with DB2, are the Environment Variables set?
Operations that run user-provided scripts have access to environment variables (for example if dSource or VDB is created using instance user inst1 then all the environment variables of user inst1 will be accessible to Hook operations).
For operations associated with specific dSources or virtual databases (VDBs), the Delphix Engine will always set environment variables so that the user-provided operations can use them to access the dSource or VDB.
How do you set variables?
Delphix Engine sets environment variable in DLPX_DATA_DIRECTORY.
Do we have a set of hooks?
There are different set of Hooks for dSource and VDBs.