如何从命令行运行 db2 sql 命令? [英] how to run db2 sql command from a command line?

查看:28
本文介绍了如何从命令行运行 db2 sql 命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么跑

  • sql 命令 UPDATE CONTACTSET EMAIL_ADDRESS = 'mytestaccount@gmail.com'
  • 通过命令行
  • 用于 db2 数据库
  • 在 Linux 上
  • 来自 shell 脚本文件?

推荐答案

您需要使用 .profile 中包含db2profile"的 id 登录到您的 linux 机器.

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

如果您不确定我在说什么,请查看 db2 实例所有者的 .profile(通常是 db2inst1,除非您在安装期间更改了它).最简单的事情可能是以 db2 实例所有者身份登录.

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.

登录后,在命令行输入db2".如果未找到db2",则重新检查 .profile 内容.

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

要执行您的 sql 命令,请在命令行中键入以下内容(替换为您要连接的数据库的名称):

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'

这篇关于如何从命令行运行 db2 sql 命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆