R连接mysql时,已列出所有表,错误Error in odbcTableExists(channel, sqtable) object 'wuliudata' not found

编程入门 行业动态 更新时间:2024-10-22 20:30:03

R连接mysql时,已列出所有表,错误Error in odbcTableExists(channel, sqtable) object 'wuliudata' not found<a href=https://www.elefans.com/category/jswz/34/1770581.html style=解决方案"/>

R连接mysql时,已列出所有表,错误Error in odbcTableExists(channel, sqtable) object 'wuliudata' not found解决方案

首先在R中连接数据库

> library(RODBC)
> myconn <- odbcConnect("mysql_data",uid="wenrui",pwd="wenrui")
> myconn
RODBC Connection 1
Details:case=tolowerDSN=mysql_dataUID=wenruiPWD=******

列出所有的数据表

> sqlTables(myconn)
  TABLE_CAT TABLE_SCHEM          TABLE_NAME TABLE_TYPE REMARKS
1     wuliu                       wuliudata      TABLE        
2     wuliu                      wuliudata2      TABLE        
3     wuliu                    wuliudatanew      TABLE        
4     wuliu                   wuliudatanew2      TABLE        
5     wuliu                   wuliudatanew3      TABLE        
6     wuliu                  wuliudataonly2      TABLE        
7     wuliu             wuliudataonly2_copy      TABLE        
8     wuliu                       wuliunew3      TABLE      

连接表

> wuliudata <- sqlFetch(myconn,wuliunew3)
Error in odbcTableExists(channel, sqtable) : object 'wuliunew3' not found

出现错误,好奇怪,这是为什么呢?

解决方案!!!

> wuliudata <- sqlFetch(myconn,"wuliunew3")
>

给表加上双引号,就不会报错了

更多推荐

R连接mysql时,已列出所有表,错误Error in odbcTableExists(channel, sqtable) object 'wuliu

本文发布于:2024-02-27 02:17:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1704830.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方案   错误   odbcTableExists   Error   mysql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!