Error in dbConnect


I am trying to connect to an SQL server to download data as RDS files, previously this script was working however my computer was reformated and the versions of R / Rstuido have changed.

packages ====


connStr <- paste0("SELECT * FROM DATABASE;")
conn <- dbConnect(odbc::odbc(),.connection_string = "driver={SQL Server};server=SQLSERVER;trusted_connection=yes;database=DATABASE;")

The Error I receive:
Error in dbConnect(odbc::odbc(), .connection_string = "driver={SQL Server};server=SQLSERVER;trusted_connection=yes;database=DATABASE;") :
could not find function "dbConnect"

For privacy, I have changed the naming convention of the database string, the script runs on my coworker's computer but not mine, and as the script has run historically I believe the issue is with my computer.

I have tried running the script on different versions of R (3.5, 4.1, 4.1.1, 4.2 and 4.3) but with no success.

Any help would be much appreciated

this is a function in a package/library called DBI, the library odbc should have installed it as part of its own install, but if this did not happen for whatever reason you should fill that gap and install DBI yourself.

Hi There,

I tried again with the DBI package loaded and still received the error:

Error: nanodbc/nanodbc.cpp:1021: IM002: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.