All Forums Tools
Tera9999 13 posts Joined 01/12
23 Sep 2015
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?

 

Fred 1096 posts Joined 08/04
23 Sep 2015

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

BTEQDEVTEAM 9 posts Joined 04/11
23 Sep 2015

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
 
 

Tera9999 13 posts Joined 01/12
23 Sep 2015

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...

Tera9999 13 posts Joined 01/12
23 Sep 2015

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

 
"

BTEQDEVTEAM 9 posts Joined 04/11
23 Sep 2015

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.

Tera9999 13 posts Joined 01/12
23 Sep 2015

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!

You must sign in to leave a comment.