Sometimes I need access to the database connection information inside a PDI transformation. I can use a Java Script scripting step to fetch the metadata for all database connections and put them on the stream. Since the Java Script step is not an input step, I'll need a Generate Rows step to act as a trigger. It will have a Limit of 1 and no fields:
The JavaScript step looks like the following:
The code is on PasteBin
here.
NOTE: Make sure the Compatibility mode checkbox is not checked (see above image).
This can be extended to fetch other information such as username, tablespace, etc. Alternatively, you can hop to
Roland's transformation to grab all JDBC metadata.
Great post Matt!
ReplyDeleteThe reader gets extra credit for doing this not just for the current transformation, but for all transformations in a folder or in a repository. You can do this using the Auto Doc step which loads TransMeta for you.
Good point! I tested with a bunch of shared connections, forgot about the local ones :)
ReplyDelete