Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run db2 sql command from a command line?

how can I run

  • sql command UPDATE CONTACT SET EMAIL_ADDRESS = '[email protected]'
  • via command line
  • for db2 database
  • on linux
  • from a shell script file?
like image 539
Radek Avatar asked Mar 25 '11 01:03

Radek


1 Answers

You need to be logged into your linux machine with an id that has "db2profile" in it's .profile.

If you are not sure what I'm talking about, look at the .profile of the db2 instance owner (usually db2inst1 unless you changed it during the install). The simplest thing would probably be to log in as the db2 instance owner.

Once you are logged in, type "db2" at the command line. If "db2" is not found, then recheck the .profile stuff.

To execute your sql command type the following at the command line (substitute with the name of the database you want to connect to):

db2 connect to <database name>
db2 UPDATE CONTACT SET EMAIL_ADDRESS = '[email protected]'
like image 144
Michael Sharek Avatar answered Sep 30 '22 11:09

Michael Sharek