If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > enter sql statements in unix

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-10-04, 11:57
ksexton ksexton is offline
Registered User
 
Join Date: May 2002
Posts: 47
Question enter sql statements in unix

Dumb question,
I am telnetted into my server.
From the unix command prompt how do I execute sql statements.

I tried:
db2 connect to my_database
Reply With Quote
  #2 (permalink)  
Old 02-10-04, 12:01
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,533
Re: enter sql statements in unix

Good start ... You have done it right

db2 "select * from table1"


Quote:
Originally posted by ksexton
Dumb question,
I am telnetted into my server.
From the unix command prompt how do I execute sql statements.

I tried:
db2 connect to my_database
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 02-10-04, 12:28
ksexton ksexton is offline
Registered User
 
Join Date: May 2002
Posts: 47
db2 not installed

My apologies for not stating this.
These are the errors I get:

$ db2 connect to my_db
ksh: db2: not found.

$ db2 "create table test (col1 integer)"
ksh: db2: not found.
Reply With Quote
  #4 (permalink)  
Old 02-10-04, 12:42
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,448
Re: db2 not installed

Quote:
Originally posted by ksexton
My apologies for not stating this.
These are the errors I get:

$ db2 connect to my_db
ksh: db2: not found.

$ db2 "create table test (col1 integer)"
ksh: db2: not found.
Execute

/home/<instance_owner_id>/sqllib/db2profile
Reply With Quote
  #5 (permalink)  
Old 02-10-04, 14:17
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,533
Re: db2 not installed

..... in the current shell

Or better add it to your .profile (or eqivalent)
Cheers
Sathyaram

Quote:
Originally posted by n_i
Execute

/home/<instance_owner_id>/sqllib/db2profile
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On