Logon Error (BTEQ)

Tools & Utilities
Enthusiast

Logon Error (BTEQ)

This is driving me crazy.  I can run scripts in bteq's interactive mode, but I cannot get it to work with the command line.

Here is my very simple script that exists at this path:

bteq << !

.logon 10.74.66.12/DBC, dbc

select top 2 * from dbc.users;

.quit

!

To execute this, I run the following: 

 bteq < /home/path/scripts/temp.btq

And then I get this error with a return code of 2:

" .logon 10.74.66.12/DBC, dbc

 select top 2 * from dbc.users;

  *** Warning: You must log on before sending SQL requests.

+---------+---------+---------+---------+---------+---------+---------+----

.quit

 *** Exiting BTEQ...

 *** RC (return code) = 2"


I have tried userids of DBC and dbc; I have tried a space after the /; I have tried a semicolon at the end of .logon.

And, yes, I know the password for dbc.  (It's not dbc btw.)

Any ideas?  I putty to the server and so could it have to do with my putty credentials?

6 REPLIES
Teradata Employee

Re: Logon Error (BTEQ)

Does the script contain only the lines you want BTEQ to process, or is the first line of the script file a bteq command?

Teradata Employee

Re: Logon Error (BTEQ)

Also, try redirecting stdout and stderr to an output file so you can see all the messages BTEQ produces. For example...

   bteq < my.in > my.out 2>&1

Enthusiast

Re: Logon Error (BTEQ)

I'm not sure what you mean, but that is my entire script above.  I realize that selecting from dbc.users is pretty boring, but I was just doing it so make sure I can run a bteq script successfully.  (I'm a newbie.)  

Once I get this to work, I'll do something worthwhile like exporting or INSERTING, etc.

I hope I answered your question...

Enthusiast

Re: Logon Error (BTEQ)

Okay, I redirected stout and sterr and I got this in the my.out file:

"BTEQ 13.10.00.11 Wed Sep 23 12:48:22 2015


+---------+---------+---------+---------+---------+---------+---------+----

bteq << !

.logon 10.74.66.12/DBC, dbc

select top 2 * from dbc.users;

 *** Warning: You must log on before sending SQL requests.

+---------+---------+---------+---------+---------+---------+---------+----

.quit

 *** Exiting BTEQ...

 *** RC (return code) = 2

"

Teradata Employee

Re: Logon Error (BTEQ)

So Fred's question was spot on. The very first thing BTEQ sees is the word "bteq". Since "bteq" is not a recognized BTEQ command keyword, BTEQ submits the instruction as an SQL request. Get rid of the leading and trailing parts that caused the "here file" submission under shell.

Enthusiast

Re: Logon Error (BTEQ)

Thanks guys!  I can now login.  For any other newbies struggling, I basically changed the file to a .sh and then got rid of the bteq << at the top line.  Yeah, pretty stupid I realize.  

Now I have a new error message, but at least it's logging in!