我有一台安装了isql的服务器。我必须从本地服务器运行查询,该服务器首先将ssh连接到服务器并连接到数据库并运行所需的查询(SELECT MID, NODE, dateformat(DATETIME,'yymmddhhnnss') as DT FROM EU_TAB WHERE DATETIME='2020-07-01'
)。但是数据库连接本身给了我以下信息:
在本地提示符下,我正在以下命令下运行:
]# ssh user@xxx.xxx.xxx.xxx "isql -SWebDB -UMyID -PMyPWD -w2222"
但是我得到以下信息。而且它无法连接。
**********************************************
* unixODBC - isql *
**********************************************
* Syntax *
* *
* isql DSN [UID [PWD]] [options] *
* *
* Options *
* *
* -b batch.(no prompting etc) *
* -dx delimit columns with x *
* -x0xXX delimit columns with XX, where *
* x is in hex, ie 0x09 is tab *
* -w wrap results in an HTML table *
* -c column names on first row. *
* (only used when -d) *
* -mn limit column display width to n *
* -v verbose. *
* -lx set locale to x *
* -q wrap char fields in dquotes *
* -3 Use ODBC 3 calls *
* -n Use new line processing *
* -e Use SQLExecDirect not Prepare *
* -k Use SQLDriverConnect *
* --version version *
* *
* Commands *
* *
* help - list tables *
* help table - list columns in table *
* help help - list all help options *
* *
* Examples *
* *
* isql WebDB MyID MyPWD -w < My.sql *
* *
* Each line in My.sql must contain *
* exactly 1 SQL command except for the *
* last line which must be blank (unless *
* -n option specified). *
* *
* Please visit; *
* *
* http://www.unixodbc.org *
* nick@lurcher.org *
* pharvey@codebydesign.com *
**********************************************
这是我在做错什么吗?
我想在本地提示符下运行以下查询:
]# ssh user@xxx.xxx.xxx.xxx "isql -SWebDB -UMyID -PMyPWD -w2222 <<EOT SELECT MID, NODE, dateformat(DATETIME,'yymmddhhnnss') as DT FROM EU_TAB WHERE DATETIME='2020-07-01' go EOT"
此处应根据查询给出结果。但是由于上述消息,我无法前进。如果它的写格式要提及EOT
中的查询,请更正我。
答案 0 :(得分:0)
isql
向您显示用法图表,因为您未正确调用它。根据显示的内容,您尝试使用的-S
,-U
和-P
选项不存在(可能是您习惯了{{1 }}?),然后您想运行:
isql