在Shinyapps.io服务器上发布后,无法从Postgres SQL中获取我的光泽应用程序中的数据

时间:2019-05-20 11:53:31

标签: r postgresql shiny publishing shinyapps

我的闪亮应用程序在本地计算机上可以正常运行,并且能够从中获取数据 将SQL发布并显示在表输出中,但是一旦我将其发布在Shinyapps.io服务器上,数据就会丢失。下面是代码。谁能指导我代码的问题所在。

library(dbplyr)
library(RPostgres)
library(DBI)
library(dplyr)
library(shiny)
library(shinydashboard)
library(lubridate)
library(rsconnect)
library(DT)
library(pool)


pool <- dbPool(

drv = Postgres(),

dbname = "xyz",
host = "a.b.c.com",
port = "5432",
user = "xxxx",
sslmode = "require",
password = "xxxxx"
)

header <- dashboardHeader(
title = 'TEST'
)

sidebar <- dashboardSidebar()

body <- dashboardBody(

div(style ="font-family: sans-serif",
  boxPlus(DT::DTOutput("table_1"),
          id = 'body_box',
          width = 'auto', status = "success",
          label_status = "danger"))

  )

   # Put them together into a dashboardPage
   ui <- dashboardPage(header,sidebar,body, skin = "black")

   server <- function(input,output,session){



  deal_hdr <- pool %>% tbl(in_schema('canada', 'deal_done')) %>%
   select(a, b, c, d) %>%
  head(10000)

 data_react <- data.frame(deal_hdr) 

  output$table_1 <- DT::renderDT(datatable(data_react,
                                       extensions = 
                          c('FixedColumns','KeyTable'), 
                                       rownames = FALSE,
                                       options = list(scrollX = TRUE,
                                                      scrollY = TRUE,
                                                      fixedColumns = 
TRUE,
                                                      keys = TRUE)))
 }

 shinyApp(ui,server)

以下是我在发布应用程序时遇到的错误:

   Error in value[[3L]](cond) : could not translate host name "a.b.c.com" to 
   address: Name or service not known Calls: local ... tryCatch -> 
   tryCatchList -> tryCatchOne -> <Anonymous> Execution halted

任何帮助将不胜感激。谢谢!

0 个答案:

没有答案