Failure to connect to odbc database in R

佐手、 提交于 2019-11-27 15:29:06

I ran across this same problem when I was first trying to connect to an Oracle database. In the end what worked for me was using odbcDriverConnect and a connection string instead of odbcConnect.

myConn <-odbcDriverConnect("Driver={Oracle in OraClient11g_home1};Dbq=NZSQL;Uid=cejacobson;Pwd=password;")

You can check on https://www.connectionstrings.com/ for your specific connection string for your database. Mine happened to be this one.

Hope this helps.

Chad

I was trying to access SQL Server database and got the same error. After using the correct format of db connection, I got access to my sql server database.

dbhandle <- odbcDriverConnect("Driver={SQL Server};Server=mydbhost;Database=mydbname;Trusted_Connection=Yes")

This is IM02 error which means name of the DSN is incorrect.

GO to ODBC and check the USER/System DSN that you should be using. Once your name of DSN is correct, you might get IM014 state error which is archtecture mismatch. In that case,

The simpler solution is IN r studio - go to tools and change the version of R to 32 bit.

It should be ready to work

What worked for me was a 32 bit connection instead of a 64 bit connection.

I know this is old but also make sure that you remove the spaces around the '=' sign. That was my problem.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!