shiny app online wasn't updated by database

Hi. I deployed a shiny app on shinyapps.io to test the database connection.
The app had been successfully published and works properly.
however, when i insert a record into the dadabase, the app doesn't update, unless I click the "restart" button in the app management page.
the database is sql server in azure. I used the flexdashboard Rmd file to build the dashboard.
the db connect code like below:

library(flexdashboard)
library(RODBC)
is_local<-Sys.getenv('SHINY_PORT')==""
dbConnector <- function(local=FALSE){
if(local){dbConn <- odbcDriverConnect("Driver=ODBC Driver 13 for SQL Server;Server=;Database=;Uid=;Pwd=;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30")
} else {dbConn <- odbcDriverConnect("Driver=FreeTDS;TDS_Version=8.0;Server=; Port=1433;Database=;Uid=;Pwd=;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30")}
}
dbConn <- dbConnector(is_local)

How do you read the data from the database? Is in response to an action? If you want to implement auto update take a look at thereactivePoll() function.

https://shiny.rstudio.com/reference/shiny/latest/reactivePoll.html

Thanks @andresrcs. I put it to the response and it runs the query immediatly.

This topic was automatically closed 7 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.