DB2数据库,有时候需要构建自动化,自动用shell命令或者其他脚本,诸如Python等脚本,自动化管理数据和表格,就需要连接数据库;
DB2连接数据库,直接执行命令
DB2 connect to 数据库名
例如:
DB2 connect to MY_DBS
DB2拉取数据
db2 "expect to /当地路径/表名.csv 或excel of del 加上 SQL语句”
例如:
db2 "expect to /userhome/myworkspace/20210325/school_sheet.csv of del select * from school_sheet where name in ('a','123')"
双引号一定不能丢!!!!!