|
|
|
Junior Member
      
Group: Forum Members
Last Login: 6/5/2008 11:39:56 AM
Posts: 11,
Visits: 3
|
|
I'm using a BTEQ script called from a Korn Shell Script toi automate the process of running SQL via BTEQ on Unix. The user simply types the shell script name followed by their SQL input file name and the script seds the file name into the BTEQ script. No problems there I've gotten it to work just fine.
Here is the issue. we can't have user passwords in a file. It can't even been in a very temporary file that lasts the life of the BTEQ job and then gets deleted.....
Is there any way to get BTEQ to prompt the end user for the password? I've tried just leaving out the password and putting everything else in the .logon command but I only get an error message
Here is my current Shell and BTEQ scripts:
Shell:
#!/bin/ksh fil=$1; scmd=s/\$infil/$fil/g sed $scmd ~/bin/cmds.scr > tmp bteq < tmp
Bteq cmds.scr file:
.set session transaction BTET .logon edw/uid,passwd; .export report file=$infil.out; .run file= $infil; .export reset; .quit;
Thanks for all your help!
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 6/5/2008 11:39:56 AM
Posts: 11,
Visits: 3
|
|
Well....... I guess by the nuber of views that this is something of interest to a great many of us..... but based on all the feedback (or lack thereof) from the Teradata team working with us for a UDB to Teradata conversion I'm guessing this just isn't possible right now.
Unfortuantely Teradata is pushing more people to SQL Assistant at the same time our company is trying to eliminate all client installed apps....
Thanks for looking!
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 11/22/2006 11:55:00 PM
Posts: 30,
Visits: 1
|
|
alternatively you can use the 'ftppwd' utility in UNIX. where in, you could store your personalized pairs of DBServername and Passwd and retrive them, dynamically from the BTEQ script. hope dis would help.
 SarathyG
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 8/1/2007 7:52:00 AM
Posts: 4,
Visits: 1
|
|
bteq cannot prompt the user for anything but korn shell can. your script becomes:
#!/bin/ksh #prepare your script fil=$1; scmd=s/\$infil/$fil/g sed $scmd ~/bin/cmds.scr > tmp
#prompt for username and password echo "enter username:" read usr echo "enter password:" read pass
#launch bteq passing username and password in the command line bteq < tmp .logon edw/$usr,$pass #end of script
As for your cmds.scr script, the only thing you have to do is remove the .logon line: .set session transaction BTET .export report file=$infil.out; .run file= $infil; .export reset; .quit;
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 6/5/2008 11:39:56 AM
Posts: 11,
Visits: 3
|
|
Nicolas,
I'll definitely give that a shot. Gets around my password issue very nicely. Thanks also to the person who sent the other suggestion! You will become plan B if I have trouble getting nicolas' idea to work.
Thanks,
I'll post the results soon!
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 6/5/2008 11:39:56 AM
Posts: 11,
Visits: 3
|
|
|
That idea worked great. I added a stty -echo and a stty echo before and after the read of the password to blank out the pasword on the screen. Thanks again!
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 6/5/2008 11:39:56 AM
Posts: 11,
Visits: 3
|
|
Well it worked up to a point. Since we pass the userid and password on the same line as the BTEQ command when you do a ps -ef you get the eniter command line back! That's right with the userid and password!
Ooops. On Solaris we got around this by creating a link that points to the bteq file and executing the link. The link is about 50 bytes long and it overflows the ps CMD buffer on Solaris.
On AIX the CMD buffer is huge. It just keeps wrapping so we aren't able to overflow it with the "whack it with a hammer" approach above. Sigh....
Anyone know how to shorten up the CMD buffer that the ps command access on AIX?
Thanks again for all the great suggestions.
TeraJag
|
|
|
|
|
Supreme Being
      
Group: PAC and SFT Members
Last Login: Yesterday @ 8:28:12 PM
Posts: 298,
Visits: 364
|
|
Why not just use a "here document"?
#!/bin/ksh
#prompt for username and password echo "enter username:" read usr echo "enter password:" read pass
bteq <<_END_ .logon edw/$usr,$pass .set session transaction BTET .export report file=$1.out; .run file=$1; .export reset; .quit; _END_
|
|
|
|