How to run db2 sql command from command line?

how can i run

  • Sql command UPDATE CONTACT SET EMAIL_ADDRESS = ' mytestaccount@gmail.com '
  • through the command line
  • for db2 database
  • on linux
  • from shell script file?
+4
source share
1 answer

You need to log in to your Linux machine with an identifier that has "db2profile" in it .profile.

If you do not know what I'm talking about, look at the .profile file of the owner of the db2 instance (usually db2inst1, if you did not change it during installation). The simplest would probably be to log in as the owner of the db2 instance.

After logging in, enter "db2" at the command prompt. If "db2" is not found, double-check the .profile file.

To execute your sql command, enter the following command at a command prompt (replace the name of the database you want to connect to):

 db2 connect to <database name> db2 UPDATE CONTACT SET EMAIL_ADDRESS = ' mytestaccount@gmail.com ' 
+11
source

Source: https://habr.com/ru/post/1345176/


All Articles