Try to search your question here, if you can't find : Ask Any Question Now ?

How to connect to MS SQL database requiring integrated active directory authentication in R using odbc and DBI packages?

HomeCategory: stackoverflowHow to connect to MS SQL database requiring integrated active directory authentication in R using odbc and DBI packages?
Avatarpragati asked 3 months ago

I am currently trying to connect to some SQL databases from within RStudio.

The one database that uses windows authentication I can access easily using:

con <- dbConnect(odbc(), Driver = "SQL Server", Server = "ServerName", 
                 Database = "DatabaseName", Trusted_Connection = "True")

However we have another database that requires integrated active directory authentication and the above code (changed for the relevant server and database names) generates the error:

Error: nanodbc/nanodbc.cpp:950: HY000: [Microsoft][ODBC SQL Server Driver][SQL Server]Windows logins are not supported in this version of SQL Server. 

I have tried various things including the following:

con <- dbConnect(odbc(), Driver = "SQL Server", Server = "Server_Two_Name", 
                 Database = "Database_2_Name", Trusted_Connection = "True", Authentication = "ActiveDirectoryIntegrated")

con <- dbConnect(odbc(), Driver = "SQL Server", Server = "Server_Two_Name", 
                 Database = "Database_2_Name", Trusted_Connection = "FALSE", Authentication = "ActiveDirectoryIntegrated")

However nothing I have tried allows me to connect successfully. (I can successfully connect to the database using SQL Server Management Studio if I specify the server and database names and set the authentication to “Active Directory – Integrated”, without needing to enter a password or user name).

I have tried reading the information at https://db.rstudio.com and the documentation for the DBI and odbc packages but I did not fully understand the information provided.

Please can anyone advise?

1 Answers
Best Answer
AvatarAmit answered 3 months ago
Your Answer

4 + 7 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com