Failure to connect to odbc database in R

Solution 1:

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.

Solution 2:

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