I've been trying to initiate a read only connection to MSSQL server using R but am having trouble.
I am able to connect without read only using the DBI and odbc packages:
library(DBI)
library(odbc)
con <- DBI::dbConnect(
odbc::odbc(),
Driver = "DRIVER",
Server = "SERVER",
Database = "DATABASE",
UID = "USERNAME",
PWD = "PASSWORD",
Port = PORT
)
(OR using connection string)
con <- DBI::dbConnect(odbc::odbc(),
.connection_string = "Driver={DRIVER};Uid=USERNAME;Pwd=PASSWORD;Server=SERVER;Port=PORT;Database=DATABASE;")
I assumed that if I added ApplicationIntent="ReadOnly"
or ApplicationIntent=ReadOnly;
to the respective codes, this would work but it results in a timeout.
I'm not really sure if this is even possible using ODBC/DBI, any help would be deeply appreciated!