【问题标题】:shiny app works locally, but not on shinyapps.io闪亮的应用程序在本地工作,但不是在shinyapps.io
【发布时间】:2018-12-22 23:33:38
【问题描述】:

我已经使用 sql server 连接创建了这个应用程序,它在我的设备上正常工作,但发布后我收到此错误 应用程序无法启动,这就是我在此错误页面中得到的内容:

    Attaching package: ‘rsconnect’

The following object is masked from ‘package:shiny’:

    serverInfo


Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union


Attaching package: ‘RODBCext’

The following objects are masked from ‘package:RODBC’:

    odbcFetchRows, sqlFetchMore


Attaching package: ‘shinydashboard’

The following object is masked from ‘package:graphics’:

    box

Warning in odbcDriverConnect("driver={SQL Server};server=************;database=*******;uid=****;pwd=*****") :
  [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specified
Warning in odbcDriverConnect("driver={SQL Server};server=************\\.,1435;database=************;uid=****;pwd=****") :
  ODBC connection failed
Error in value[[3L]](cond) : first argument is not an open RODBC channel
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

我的代码将在这里: my app code

【问题讨论】:

  • 正如错误所说,您的 ODBC 未在部署应用程序的 linux 机器上配置
  • 我在 Windows 而不是 linux 上工作
  • Shinyapps.io 在 linix 盒子上
  • 我该如何解决?
  • 当您配置ODBC 连接时,您可能指定在windows 机器中,而不是R。我建议您使用另一个包,例如RMySQL cran.r-project.org/web/packages/RMySQL/index.html

标签: r shiny shiny-server


【解决方案1】:

我通过使用 dbConnect & DBI 库而不是 RODBC 并使用 RSQLServer::SQLServer() 在 sql server 上打开连接解决了这个问题。我感谢@PorkChop 在这方面给了我帮助。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2018-03-23
  • 2021-01-29
  • 2020-03-12
  • 2018-02-03
  • 2019-04-24
  • 2016-06-15
  • 2018-06-11
  • 2021-08-17
相关资源
最近更新 更多