Page 1 of 1

multiple instances of Db2

Posted: Wed Nov 26, 2003 8:38 am
by rob1
How can we connect datastage jonb to different db2 instances ?
eg : 1 job uses db2 instance a and 1 job uses db2 instance b

Is it possible to modify dsenv to set variable DB2INSTANCE ?
at first glance, it seems that this shell is executed only once when datastage server is set up, and not each time a job is started.

Posted: Wed Nov 26, 2003 9:28 am
by Kim Bundgaard
You don't connect to an instance, but to a database (DSN).
Catalog the two different databases, and you have the option to choose between the two databases.

Posted: Thu Nov 27, 2003 7:38 am
by ray.wurlod
The job itself can set an environment variable. So can an active stage.

In the Transformer stage that drives the connection to DB2, set up ExecTCL as a before-stage subroutine (in the Stage Properties window), and put the an ENV command into the Input Value field. The ENV command to set an environment variable has the syntax:

Code: Select all

ENV SET variable=value
You can also:

Code: Select all

ENV CLEAR variable

Posted: Fri Nov 28, 2003 10:00 am
by rob1
Thanks,
Is it possible to set another variable in the same way ?
What is the syntax ?

I have one job control which launches many other jobs who access to Db2.
Do I have to set these variables in the job control or in each job ?

Posted: Sun Nov 30, 2003 8:33 am
by ray.wurlod
What do you mean by another variable? Another environment variable?

If you do this in a job control routine, you would invoke the command using the PERFORM statement (or via a call to DSExecute). Since controlled jobs run as child processes of control jobs, they inherit their parents' environment variables.

Or you can set them in the individual jobs, as advised earlier.