Hello,
I am making a small project and want to host it on shinyapps. In it I am connecting to an Azure database I have set up. When connecting from my local session everything is working fine however when deploying it to shinyapps i am getting this error:
Error in local({ :
! ODBC failed with error 00000 from [RStudio][SqlServer].
✖ Failed to locate Server/Instance Specified.
ℹ From 'nanodbc/nanodbc.cpp:1150'.
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
I have followed the shinyapps guide on deploying an app with a connection to an external database carefully but have not been able to fix the issue or find a similar issue online.
This is my connection R code :
con_string <- "Driver={__DRIVER__};
Server=<server>;
Database=set_daily;
Uid=__USER__;
Pwd=__PASSWD__;
Encrypt=yes;
TrustServerCertificate=yes;
Connection Timeout=1000;"
con <- DBI::dbConnect(
odbc::odbc(),
.connection_string = con_string %>%
stringi::stri_replace_all(fixed = "__USER__", config::get("azure_user")) %>%
stringi::stri_replace_all(fixed = "__PASSWD__", config::get("azure_pwd")) %>%
stringi::stri_replace_all(fixed = "__DRIVER__", config::get("driver"))
)
My config.yml is like so:
default:
azure_pwd: '<pwd>'
azure_user: '<user>'
driver: 'ODBC Driver 18 for SQL Server'
shinyapps:
azure_pwd: '<pwd>'
azure_user: '<user>'
driver: 'SQLServer'
Thanks in advance for any help