需要使用unix shell脚本连接DB2数据库

需要使用unix shell脚本连接DB2数据库,unix,db2,Unix,Db2,需要使用unix shell脚本连接到DB2数据库 我每次都使用QMF工具运行DB2查询。现在我需要通过shell脚本来连接它。 DSN名称--GM2P 数据库名称--DPPRICMG 表名--项 如有任何帮助和建议,将不胜感激。 谁能尽快回答这个问题。 谢谢为了正确运行脚本,必须对远程数据库进行编目,如下所示: db2 catalog tcpip node NODE1 remote ip.ip.ip.ip server 50000 db2 catalog database mydb1 at n

需要使用unix shell脚本连接到DB2数据库 我每次都使用QMF工具运行DB2查询。现在我需要通过shell脚本来连接它。 DSN名称--GM2P 数据库名称--DPPRICMG 表名--项 如有任何帮助和建议,将不胜感激。 谁能尽快回答这个问题。
谢谢

为了正确运行脚本,必须对远程数据库进行编目,如下所示:

db2 catalog tcpip node NODE1 remote ip.ip.ip.ip server 50000
db2 catalog database mydb1 at node NODE1 authentication server
然后,您可以使用此脚本发出所需的任何sql:

db2 connect to mydb2 user username using password
db2 "update bla bla bla "
db2 connect reset

请注意,如果您使用的是DB2 for z/OS,那么编目将有点不同。

为了正确运行脚本,必须对远程数据库进行编目,如下所示:

db2 catalog tcpip node NODE1 remote ip.ip.ip.ip server 50000
db2 catalog database mydb1 at node NODE1 authentication server
然后,您可以使用此脚本发出所需的任何sql:

db2 connect to mydb2 user username using password
db2 "update bla bla bla "
db2 connect reset

请注意,如果您使用DB2 for z/OS,那么编目将有点不同。

DB2是否在unix机器上运行?DB2是否在unix机器上运行?