how to run db2 sql command from a command line?

喜你入骨 提交于 2019-12-06 02:24:00

问题


how can I run

  • sql command UPDATE CONTACT SET EMAIL_ADDRESS = 'mytestaccount@gmail.com'
  • via command line
  • for db2 database
  • on linux
  • from a shell script file?

回答1:


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'


来源:https://stackoverflow.com/questions/5427441/how-to-run-db2-sql-command-from-a-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!