数据库删除:在 Ubuntu 上找不到 Informix 命令

Database drop: command not found Informix on Ubuntu

我正在尝试 运行 源代码以使用以下行在 Informix 中编辑数据库: 删除 table 如果存在 tablename;

但是我收到一条错误消息: 删除:找不到命令

我正在尝试 运行 源代码以使用以下行在 Informix 中编辑数据库: 删除 table 如果存在 tablename;

但是我收到一条错误消息: 删除:找不到命令

我是数据库新手,Ubuntu 所以这对我来说不是直截了当的。请帮忙解决这个问题。谢谢。

#!/bin/bash
export PATH=$PATH:.
#UTC
dt="2016-09-01 00:00:00.00000"
# dt=`date -u +"%Y-%m-%d %H:%M:%S.00000"` 
# non-UTC
# dt=`date +"%Y-%m-%d %H:%M:%S.00000"`

echo ""
echo "Building DB"
dbaccess sysmaster - <<EOF1

drop database if exists iot;
create database iot in datadbs1 with buffered log ; 
EOF1

echo ""
echo "Building row types, tables, and other objects" dbaccess iot - 


drop table if exists sensors;
drop table if exists sensors_vti;
...

您不能在 bash 中使用 db 命令(直接)

drop table if exists sensors;
drop table if exists sensors_vti;

您需要使用的格式是

dbaccess sysmaster - <<EOF
    drop database if exists iot;
    create database iot in datadbs1 with buffered log ; 
EOF

或者

echo "drop database if exists iot;create database iot in datadbs1 with buffered log ;" | dbaccess sysmaster