how to run db2 sql command from a command line?
how can I run
- sql command
UPDATE CONTACT SET EMAIL_ADDRESS = 'mytestaccount@gmail.com'
- via co开发者_运维百科mmand line
- for db2 database
- on linux
- from a shell script file?
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 = 'mytestaccount@gmail.com'
精彩评论