﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Teradata Forums / Teradata  / Teradata Tools and Utilities  / Can BTEQ Prompt User for Password in Scripts / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>Teradata Forums</description><link>http://www.teradata.com/teradataforum/</link><webMaster>info@teradata.com</webMaster><lastBuildDate>Thu, 04 Dec 2008 03:19:38 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>Just wanted to update this thread with the final script. This script allows for versioning the output files and an alternate directory to place the output in. Meets our need of not storing passwords in a file on the system.&lt;br&gt;&lt;br&gt;&lt;br&gt;if [ $# -lt 1 ];then&lt;br&gt;  echo usage: `basename $0` yourjob.sql + optional directory&lt;br&gt;  echo For output in current directory: tdsql yourjob.sql&lt;br&gt;  echo For output in specified location: tdsql yourjob.sql /camsrvr/largefile/userid/&lt;br&gt;  exit 9&lt;br&gt;fi&lt;br&gt;&lt;br&gt;dir=""&lt;br&gt;if [ $# -gt 1 ];then&lt;br&gt;   dir=$2&lt;br&gt;fi&lt;br&gt;&lt;br&gt;# File name for output&lt;br&gt;tt=$1&lt;br&gt;ex1="out"&lt;br&gt;out1="$dir$tt.$ex1"&lt;br&gt;i=1&lt;br&gt;while [ -f $out1 ]&lt;br&gt;do&lt;br&gt;    out1="$dir$tt.$ex1.$i"&lt;br&gt;   (( i = $i + 1 ))&lt;br&gt;done&lt;br&gt;echo &gt;$out1&lt;br&gt;&lt;br&gt;#File name for nohup output&lt;br&gt;tl=$1&lt;br&gt;ex3="log"&lt;br&gt;log="$1.$ex3"&lt;br&gt;i=1&lt;br&gt;while [ -f $log ]&lt;br&gt;do&lt;br&gt;    log="$tl.$ex3.$i"&lt;br&gt;   (( i = $i + 1 ))&lt;br&gt;done&lt;br&gt;&lt;br&gt;echo &gt;$log&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;#prompt for uname and password&lt;br&gt;&lt;br&gt;echo "Enter Teradata User Name: "&lt;br&gt;read usr&lt;br&gt;&lt;br&gt;echo "Enter Password: "&lt;br&gt;stty -echo&lt;br&gt;read pass&lt;br&gt;stty echo&lt;br&gt;&lt;br&gt;nohup  bteq &lt;&lt;_END__ &gt;$log 2&gt;&amp;1&amp;&lt;br&gt;.set session transaction BTET&lt;br&gt;.logon edwprod/$usr,$pass&lt;br&gt;.export report file=$out1 ;&lt;br&gt;.run file=$1;&lt;br&gt;.export reset;&lt;br&gt;.quit;&lt;br&gt;_END_&lt;br&gt;stty echo&lt;br&gt;</description><pubDate>Thu, 04 Jan 2007 13:52:08 GMT</pubDate><dc:creator>TeraJaguar</dc:creator></item><item><title>RE: Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>That did it. Works great and no passwords to be found.&lt;br&gt;&lt;br&gt;Thanks!</description><pubDate>Mon, 23 Oct 2006 14:53:32 GMT</pubDate><dc:creator>TeraJaguar</dc:creator></item><item><title>RE: Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>Why not just use a "here document"?&lt;br&gt;&lt;br&gt;#!/bin/ksh&lt;br&gt;&lt;br&gt;#prompt for username and password&lt;br&gt;echo "enter username:"&lt;br&gt;read usr&lt;br&gt;echo "enter password:"&lt;br&gt;read pass&lt;br&gt;&lt;br&gt;bteq &lt;&lt;_END_&lt;br&gt;.logon edw/$usr,$pass&lt;br&gt;.set session transaction BTET&lt;br&gt;.export report file=$1.out;&lt;br&gt;.run file=$1;&lt;br&gt;.export reset;&lt;br&gt;.quit;&lt;br&gt;_END_&lt;br&gt;</description><pubDate>Fri, 20 Oct 2006 17:13:30 GMT</pubDate><dc:creator>Fred Pluebell</dc:creator></item><item><title>RE: Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>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!&lt;br&gt;&lt;br&gt;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.&lt;br&gt;&lt;br&gt;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....&lt;br&gt;&lt;br&gt;&lt;br&gt;Anyone know how to shorten up the CMD buffer that the ps command access on AIX?&lt;br&gt;&lt;br&gt;&lt;br&gt;Thanks again for all the great suggestions.&lt;br&gt;&lt;br&gt;TeraJag</description><pubDate>Thu, 19 Oct 2006 15:30:06 GMT</pubDate><dc:creator>TeraJaguar</dc:creator></item><item><title>RE: Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>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!</description><pubDate>Fri, 06 Oct 2006 14:03:35 GMT</pubDate><dc:creator>TeraJaguar</dc:creator></item><item><title>RE: Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>Nicolas,&lt;br&gt;&lt;br&gt;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.&lt;br&gt;&lt;br&gt;&lt;br&gt;Thanks, &lt;br&gt;&lt;br&gt;I'll post the results soon!</description><pubDate>Thu, 05 Oct 2006 11:46:21 GMT</pubDate><dc:creator>TeraJaguar</dc:creator></item><item><title>RE: Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>bteq cannot prompt the user for anything but korn shell can.&lt;br&gt;your script becomes:&lt;br&gt;&lt;br&gt;#!/bin/ksh&lt;br&gt;#prepare your script&lt;br&gt;fil=$1;&lt;br&gt;scmd=s/\$infil/$fil/g&lt;br&gt;sed $scmd ~/bin/cmds.scr &gt; tmp&lt;br&gt;&lt;br&gt;#prompt for username and password&lt;br&gt;echo "enter username:"&lt;br&gt;read usr&lt;br&gt;echo "enter password:"&lt;br&gt;read pass&lt;br&gt;&lt;br&gt;#launch bteq passing username and password in the command line&lt;br&gt;bteq &lt; tmp .logon edw/$usr,$pass&lt;br&gt;#end of script&lt;br&gt;&lt;br&gt;As for your cmds.scr script, the only thing you have to do is remove the .logon line:&lt;br&gt;.set session transaction BTET&lt;br&gt;.export report file=$infil.out;&lt;br&gt;.run file= $infil;&lt;br&gt;.export reset;&lt;br&gt;.quit;&lt;br&gt;</description><pubDate>Thu, 05 Oct 2006 07:32:38 GMT</pubDate><dc:creator>nicolas</dc:creator></item><item><title>RE: Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>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.</description><pubDate>Thu, 05 Oct 2006 02:36:56 GMT</pubDate><dc:creator>SarathyG</dc:creator></item><item><title>RE: Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>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.&lt;br&gt;&lt;br&gt;Unfortuantely Teradata is pushing more people to SQL Assistant at the same time our company is trying to eliminate all client installed apps....&lt;br&gt;&lt;br&gt;Thanks for looking!</description><pubDate>Tue, 03 Oct 2006 09:06:59 GMT</pubDate><dc:creator>TeraJaguar</dc:creator></item><item><title>Can BTEQ Prompt User for Password in Scripts</title><link>http://www.teradata.com/teradataforum/Topic5208-10-1.aspx</link><description>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.&lt;br&gt;&lt;br&gt;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..... &lt;br&gt;&lt;br&gt;Is there any way to get BTEQ to prompt the end user for the password?    &lt;br&gt;I've tried just leaving out the password and putting everything else in the .logon command but I only get an error message&lt;br&gt;&lt;br&gt;&lt;br&gt;Here is my current Shell and BTEQ scripts:&lt;br&gt;&lt;br&gt;Shell:&lt;br&gt;&lt;br&gt;#!/bin/ksh&lt;br&gt;fil=$1;&lt;br&gt;scmd=s/\$infil/$fil/g&lt;br&gt;sed  $scmd ~/bin/cmds.scr &gt; tmp&lt;br&gt;bteq &lt; tmp&lt;br&gt;&lt;br&gt;Bteq cmds.scr file:&lt;br&gt;&lt;br&gt;.set session transaction BTET&lt;br&gt;.logon edw/uid,passwd;&lt;br&gt;.export report file=$infil.out;&lt;br&gt;.run file= $infil;&lt;br&gt;.export reset;&lt;br&gt;.quit;&lt;br&gt;&lt;br&gt;Thanks for all your help!&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</description><pubDate>Mon, 18 Sep 2006 13:43:58 GMT</pubDate><dc:creator>TeraJaguar</dc:creator></item></channel></rss>