Reputation: 146
I have been trying to connect SQL database (in Azure) to shinyapp deployed in shinyapps.io, but I could connect to the database from local R console. Please let me know what I am doing wrong?
This is the connection string in Azure SQL DB.
And this is what I am trying from local R console and the connection was successful.
con <- dbConnect(
odbc(),
Driver = "SQL Server Native Client 11.0",
Server = "xxxx.database.windows.net",
Database = "hist_data",
UID = "narendra",
PWD = "xxx",
Port = 1433
)
I had also connected the Database to the local SSMS.
When I deploy the app, getting error:
nanodbc/nanodbc.cpp:1021: 00000: [unixODBC][Driver Manager]Can't open lib 'SQL Server Native Client 11.0' : file not found
Upvotes: 0
Views: 300
Reputation: 549
I resolved it by removing "tcp:" from the server name prefix. You also need to adjust the driver name to "SQLServer".
Upvotes: 0
Reputation: 146
I tried to set Driver = "FreeTDS" along with TDS_Version, but it didn't work. However, when I removed the TDS_Version, the app started working on shinyapps.io.
Upvotes: 1