We are facing a situation by which we would like to use the tdwallet as well as passing the variables from shell into bteq at the same time, we have been using hidden files for our login variables, however we would like to start using tdwallet for any new programs. The scenario is given below.
We have a shell which calls a bteq file after we pass the variables like dns , userid and password ( they are all from our hidden files ) as below
export dns export userid export pwd bteqpath/bteqfilename.bq
Inside the bteq file we have the following
bteq << EOF .logon $dns/$userid,$pwd ; sel * from ****; EOF
We would like to use the tdwallet feature and while we could not assign the value of the tdwallet to any variable and can be passed only during the login pass, we find it difficult to get a breakthrough. Mainly because the syntax "$tdwallet(walletname)" is considered as a string itself and is not getting replaced by the walletpassword assosiated with the walletname
bteq << EOF .logon $dns/$userid,"$tdwallet(walletname)"; sel * from ****; EOF
it works if we do not pass shell variables into the bteq program an just hardcode the dns , userid etc inside the bteq file and call the bteq as follows.
Have you come accross any scenarios where you had to pass the variables as well as use the tdwallet at the same time ?
Note:- the useage of sed is not really our requirement as we would like to pass the varaibles dynamically than creating or replacing the content of the bteq file each time.
Let me know if you want anymore information, appreciate if anyone of you can shed some light in this.
Have you tried escaping the dollar sign so that the $tdwallet keyword is not interpreted by the shell as an environment variable?
See this comment after the "Introducing Teradata Wallet" article (there are multiple pages of comments, and there may even be a better one than the linked)
Consider storing the userid in the wallet also. You could even simplify your scripts by using a single variable, say $userid, and using it as follows (see the aforementioned article for details):