RODBC错误-ODBC连接失败-无法使用我的Mac连接到MySQL(Mavericks) [英] RODBC error - ODBC connection failed - can't connect to MySQL with my mac (mavericks)

查看:264
本文介绍了RODBC错误-ODBC连接失败-无法使用我的Mac连接到MySQL(Mavericks)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的Mac(小牛)上使用RODBC通过R连接到mysql数据库,但是经过数小时的努力之后,我仍然无法正常工作.当我尝试连接到数据库时,RODBC会引发此错误(错误消息非常简短,我不知道这意味着什么):

I am trying to connect to a mysql database through R using RODBC on my mac (mavericks) but after a stupid number of hours of effort, I still can't get it working. When I try to connect to a database, RODBC throws this error (error message is so terse, I don't know what it means):

ch<-odbcConnect("mydatabasename")警告消息:1:在odbcDriverConnect(" DSN = mydatabase)中:[RODBC]错误:状态H,代码0,消息[unixODBC] [2:在odbcDriverConnect( "DSN = mydatabasename"):ODBC连接失败"

ch <- odbcConnect("mydatabasename") "Warning messages: 1: In odbcDriverConnect("DSN=mydatabase") : [RODBC] ERROR: state H, code 0, message [unixODBC][ 2: In odbcDriverConnect("DSN=mydatabasename") : ODBC connection failed"

按照以下博客(安装unixODBC)中的说明到达所需位置: http://hiltmon.com/博客/2013/09/18/setup-odbc-for-r-on-os-x/

I got to where I am at by following the instructions at the following blog (install unixODBC): http://hiltmon.com/blog/2013/09/18/setup-odbc-for-r-on-os-x/

如果输入:

isql -v mydatabasename

isql -v mydatabasename

我从源代码安装了R,并且安装过程中没有出现明显的错误,但是现在当我尝试通过以下方式从Rstudio连接到数据库时:

I installed R from source and the install worked with no noticeable errors, but now when I try to connect to a database from Rstudio, with:

ch<-odbcConnect("mydatabasename")

ch <- odbcConnect("mydatabasename")

我收到ODBC连接失败错误.谁能帮助我了解此错误的含义?还是我可能会解决它?或者我可以和谁交谈以获得帮助?

I get the ODBC connection failed error. Can anyone help me understand what this error means? Or how I could potentially fix it? Or who I can talk with to get some help?

您会阻止我开枪射击自己.哈哈!但是认真的...你会的.

You would keep me from shooting myself. haha! But seriously... you would.

推荐答案

我遇到了与您报告的问题完全相同的问题. 我的ODBC连接使用的是MySQL ODBC 5.3 Unicode驱动程序(/usr/local/lib/libmyodbc5w.so) 尽管我可以连接iSQL,但实际的SQL命令正在返回垃圾.

I had exactly the same problem as you've reported. My ODBC connection was using the MySQL ODBC 5.3 Unicode Driver (/usr/local/lib/libmyodbc5w.so) Although I could connect with iSQL, actual SQL commands were returning garbage.

我尝试将odbc.ini更改为使用ANSI驱动程序(/usr/local/lib/libmyodbc5a.so). 它可以正常工作,现在RODBC可以连接到我的MySQL数据库.

I tried changing my odbc.ini to use the the ANSI driver instead (/usr/local/lib/libmyodbc5a.so). It worked and now RODBC can connect to my MySQL database.

这篇关于RODBC错误-ODBC连接失败-无法使用我的Mac连接到MySQL(Mavericks)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆