我有一个工作的Shiny App通过pool
查询远程MySQL数据库,我可以在我的本地机器上运行。
MySQL服务器有whitelisted shinyapps.io IP addresses.
当我将它部署到shinyapps.io时,我收到此错误:
library(shiny)
library(DBI)
library(pool)
library(DT)
pool <- dbPool(
drv = RMySQL::MySQL(),
dbname = "gw_observatory",
host = "sage.metro.ucdavis.edu",
username = "gw_observatory",
password = "password"
)
onStop(function() {
poolClose(pool)
})
shinyServer(function(input, output, session) {
output$data_table <- renderDataTable({
DT::datatable(pool %>% tbl("small_data") %>% collect())
})
shinyUI(
fluidPage(
mainPanel(DT::dataTableOutput("data_table"))
)
)
更新:它现在有效。我的系统管理员添加了一个端口,这解决了问题。
对于遇到此问题的任何人,我建议采取以下步骤:
我希望这有助于有人下线!
pool <- dbPool(
drv = RMySQL::MySQL(),
dbname = "some_name",
host = "123.45.678.901",
username = "some_username",
password = "password",
port = 1234567
)