gpt4 book ai didi

mysql - RODBC 错误 : Could not SQLExecDirect in mysql

转载 作者:IT王子 更新时间:2023-10-29 00:36:28 25 4
gpt4 key购买 nike

我一直在尝试编写一个 R 脚本来查询 Impala 数据库。这是对数据库的查询:

select columnA, max(columnB) from databaseA.tableA where columnC in (select distinct(columnC) from databaseB.tableB ) group by columnA order by columnA 

当我手动运行此查询时(阅读:通过 impala-shell 在 Rscript 之外),我能够获取表内容。但是,当通过 R 脚本尝试相同时,我收到以下错误:

[1] "HY000 140 [Cloudera][ImpalaODBC] (140) Unsupported query."       
[2] "[RODBC] ERROR: Could not SQLExecDirect 'select columnA, max(columnB) from databaseA.tableA where columnC in (select distinct(columnC) from databaseB.tableB ) group by columnA order by columnA'
closing unused RODBC handle 1

为什么通过 R 尝试查询失败?我该如何解决这个问题?在此先感谢:)

编辑 1:

连接脚本如下:

library("RODBC");
connection <- odbcConnect("Impala");
query <- "select columnA, max(columnB) from databaseA.tableA where columnC in (select distinct(columnC) from databaseB.tableB ) group by columnA order by columnA";
data <- sqlQuery(connection,query);

最佳答案

需要安装相关驱动,请看下面link

我遇到了同样的问题,我所要做的就是更新 ODBC 驱动程序。

此外,如果您可以使用用户名和密码更新您的 odbcConnect

connection <- odbcConnect("Impala");

connection <- odbcConnect("Impala", uid="root", pwd="password")

关于mysql - RODBC 错误 : Could not SQLExecDirect in mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30168057/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com