How about you read configuration parameters from a CMDB into global cache when server/message flows start.
This can reduce the need for UDP and overwrites.
Your Option1 - should work - though I also don't know the syntax by heart. You may require Eval.
Perhaps
https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ak05020_.htmpoints into the solution.
------------------------------
Matthias Jungbauer
------------------------------
Original Message:
Sent: Wed March 24, 2021 01:29 PM
From: John Hawkins
Subject: Simplifying Database Schema for ESQL coders
Hi Folks,
Trying to call a stored procedure which is defined in a database utils library. However, the schema changes between environments e.g.
CREATE PROCEDURE updateDB()
LANGUAGE DATABASE
EXTERNAL NAME SomeStoredProcedure
which allows me to call the database using...
DECLARE DBSchemaName EXTERNAL CHARACTER;
CALL UpdateDB() IN Database.{DBSchemaName}
I can then create a UDP called DBSchemaName and override it per environment.
However, this requires that every time someone uses updateDB in a compute node that they have to DECLARE the DBSchemaName variable, create a UDP and override it in *EVERY* bar file that uses the database library. This is very tedious and prone to errors so I'm trying to find a way of keeping the UDP with the database library so that I can just deploy the library once with a "policy"/UDP per environment - but I can't think of a way. Here's what I've tried (and failed with)...
Option 1:
Define the schema dynamically in the Database module e.g can I do something like:
CREATE PROCEDURE updateDB()
LANGUAGE DATABASE
EXTERNAL NAME {DBSchema}.SomeStoredProcedure
I've tried every combination I can think of and it doesn't work for me - it will only allow a hard-coded name for the stored procedure's name.
Option 2:
Create a library that wrappers the Stored Procedure and keep this with the stored procedures e.g.
DECLARE DBSchema EXTERNAL CHARACTER;
CREATE FUNCTION updateDB() BEGIN
CALL ExportShipmentsImpl() IN Database.{DBSchema};
END;
However, I can't find a way to override the DBSchema variable as it's not promotable ?
Am I doing something wrong or is this simply not possible to do and I'm going to have to cope with the pain of the original way of doing it (which is the IBM recommended way from what I can see btw). I' ve started to look at a user-defined policy but can't imagine that this would work any better in terms of being able to get it to work - as unless DBSchema is promotable nothing will work???
Any thoughts gurus ?
thanks,
john.
------------------------------
John Hawkins
Integration Consultant
------------------------------