Page 1 of 1

Environment Variables

Posted: Fri Nov 09, 2007 10:51 am
by Thanh Dalton
Hi all,

I have read all I could about the evironment variables on this forum.

I created a user-defined environment variable under administrator as $Server_NAME.

In my Job Properties, I add environment variable $Server_NAME under Parameters. In the default value, I could see the value that I put in by Administrator.

I put #$Server_NAME# in the Server Name of the DB2 stage.
I compiled and ran the job and got the error below. I tried to change the default value as $PROJDEF for $Server_NAME under Parameters. I compiled and ran the job again and still got the same error below.

DB2_UDB_API_0,0: Fatal Error: Fatal: [IBM][CLI Driver] CLI0124E Invalid argument value. SQLSTATE=HY009
DSTAGE-DB2CLI-0005`:`Unable to connect to DB2 server 'NOTLIKELYDSCAPIOP_$Server_NAMENOTLIKELY'.

Any advice? Please help!
Thanks
TD

Posted: Fri Nov 09, 2007 11:18 am
by throbinson
Do a search on DSCAPIOP.

Looks like the DB2 Stage cannot resolve the Environment variable.

There should be a patch. Request it.

Posted: Fri Nov 09, 2007 12:23 pm
by lstsaur
TD,
Has the connection between DB2 client and DB2 server been configured?
All necessary entries for DB2 been populated in dsenv? Have you tested the DB2 connection from the command line?

Posted: Fri Nov 09, 2007 11:15 pm
by rleishman
Instead of running the job, try View Data from the DB2 stage in the designer window.

There is a bug in the Dynamic RDBMS stage (at least in v8) whereby it DOES recognise environment variables when you View Data, but does NOT when you run the job.

Possibly the same bug exists in the DB2 stage

Posted: Tue Nov 13, 2007 9:46 am
by Thanh Dalton
Thanks to all for your advice.

I have tried to hard code the values and I got the DB2 connection works fine. I tried to use GetEnvironment variable and I did get it. But as soon as I want to apply to the DB2 stage and I got the problem.

I have read so much on this forum about this problem. Someone said he had the same problem and solved it by dsenv. He didn't say in details on it.

I don't know what it is. Can anybody tell me what it is and how to solve the problem with this???

Thank you so much in advance!
TPQ

Posted: Tue Nov 13, 2007 10:46 am
by richdhan
Hi,

Are you using the DB2 Enterprise Stage or DB2 API stage?

Try connecting to DB2 using these 2 stages.

Dont use the environment variable for now.

Just create a job parameter say server and try to use the parameter.

I have had the same issue with Teradata Multiload stage. It does not accept parameters which are defined as environment variables.

HTH
--Rich

Environment Variables

Posted: Tue Nov 13, 2007 11:07 am
by craviraj
Sometimes connecting using ODBC stage solves the problem. There were instances where we could not connect to DB2 using DB2 stages, but were able to connect using ODBC stage.

Re: Environment Variables

Posted: Tue Nov 13, 2007 12:24 pm
by Thanh Dalton
I use DB2 API stage and when I clicked on the Review Data button, I got the result correctly from the SQL that I wrote. But when I ran the job, the DB2 stage didn't recognize the environment variable.

I tried with ODBC but it didn't work with the environment variable. I worked with the Server Name that I clicked from the DataSource button.

I need to set up the environment variables which we could use with multi environments later for our system.
Thanks,
TPQ

Posted: Tue Nov 13, 2007 12:33 pm
by richdhan
Hi TPQ,

As I mentioned earlier do not use the job parameter which you picked from the environment variables list ($Server_Name) to be used in the DB2 API stage.

Create a parameter which is unique to the job say Server_NAME.

Create a job sequence and add the environment variable $Server_Name in the job parameter list. Add the parallel job as a job activity in the sequence. In the job activity parameter list map $Server_Name to Server_Name.

This should solve your problem.

--Rich

Posted: Tue Nov 13, 2007 12:59 pm
by Thanh Dalton
Thanks a million, Rich!

I got it worked.
TPQ