title: Shiny app can't access SQLite db on RStudio Connect Server: "database is locked"
body: <p>I've deployed an R Shiny app on a R Studio Connect Server and I'm simply trying to get data from a SQLite database which I've included in the deployed application.</p>
  <p>When I run the app locally (through the runApp function), everything works fine and the data is fetched from the database.</p>
  <p>When I run the app from the R Studio Connect Server, I have the following error message: &quot;Warning: Error in : database is locked&quot; I do not understand why the db is locked or how to unlock it.</p>
  <p>The tree of the deployed application looks like this</p>
  <pre><code>- app.R
  - data/
  |-- database.db
  </code></pre>
  <p>The code of my shiny app is as follows:</p>
  <pre><code>library(dplyr)
  library(shiny)
  library(RSQLite)
  
  loadData &lt;- function() {
      path_to_db &lt;- &quot;data/database.db&quot;
      # Connect to the database
      db &lt;- dbConnect(SQLite(), path_to_db)
      # Construct the fetching query
      isin_static_info_tb = &quot;isin_static_info_table&quot;
      query &lt;- sprintf(&quot;SELECT * FROM %s&quot;, isin_static_info_tb)
      # Submit the fetch query and disconnect
      data &lt;- dbGetQuery(db, query)
      dbDisconnect(db)
      data
  }
  
  # Define UI for application that draws a histogram
  ui &lt;- fluidPage(
  
      actionButton(inputId = &quot;displayTable&quot;, label = &quot;Show table&quot;),
      
      tags$hr(),
      
      tableOutput(outputId = &quot;table&quot;)
      
  )
  
  # Define server logic required to draw a histogram
  server &lt;- function(input, output) {
      
      data &lt;- eventReactive(input$displayTable, {
          return(loadData())
      })
      
      output$table &lt;- renderTable(data())
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  
  </code></pre>