Shiny and real-time hookup to Oracle

612 views
Skip to first unread message

Jeff Chen

unread,
Jun 20, 2013, 9:10:10 PM6/20/13
to shiny-...@googlegroups.com
Hi all,

Is it possible to develop a Shiny app, have it hooked up to a Oracle data warehouse so that the app can suck in new data on a daily basis? 

Thanks,

JC

Joe Cheng

unread,
Jun 21, 2013, 1:31:04 AM6/21/13
to shiny-...@googlegroups.com
Yes, although depending on how long it takes to "suck in new data", you might not want to have the data fetching happen in the Shiny process itself, as the data fetching will block the app from doing anything else. If it'll take a long time then you could just set up a separate R script for downloading the data to disk, and run it automatically using cron or something similar.

If you do want to run it in Shiny, then you would do it by setting up a reactive expression that does the querying and returns a data frame, and also calls invalidateLater with however long you want between refreshes.


--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jeff Chen

unread,
Jun 21, 2013, 7:38:29 AM6/21/13
to shiny-...@googlegroups.com
Thanks!

Isabell Baldauf

unread,
Jan 7, 2016, 9:24:03 AM1/7/16
to Shiny - Web Framework for R
Dear Joe,
I'm trying to create an Shiny-App which can suck in new Oracle data.
Unfortunately it does not work and I do not know where my mistake lies.
Here is my mini example:

## ui.R
library(shiny)
library(ROracle)
library(ggplot2)
shinyUI(fluidPage(
  titlePanel("Prototyp Shiny"),
  sidebarLayout(
    sidebarPanel(
      numericInput(
        inputId = "anr",
        label="Artikelnummer",
        value=""
      )
    ),
   
    # Show a plot of the generated distribution
    mainPanel(
      dataTableOutput("anzk")
    )
  )
))

##Server.R
library(shiny)
library(ROracle)
library(ggplot2)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
    art_re <- reactive({
    drv <- dbDriver("Oracle")
    con <- dbConnect(drv,username="**",password="**",dbname="**")
    res <- dbSendQuery(con,paste0("select count(*) from kuart_mon where firma='00' and artnr=",input$anr,"and periode='201512'"))
   
    art_res <- fetch(res)
    dbDisconnect(con)
    art_res}) 

    renderTable({output$anzk <- art_re})
})

runApp('H:\\Profile\\Projekte\\Prototype_shiny\\app_1')

Thanks for your help.

Isabell Baldauf

unread,
Jan 8, 2016, 9:36:46 AM1/8/16
to Shiny - Web Framework for R
 I have found my mistake. Thank you anyway :-)


Joe Cheng

unread,
Jan 8, 2016, 4:38:16 PM1/8/16
to Isabell Baldauf, Shiny - Web Framework for R
Hopefully it was this?

    renderTable({output$anzk <- art_re})

becomes

    output$anzk <- renderTable({ art_re() })

On Fri, Jan 8, 2016 at 6:36 AM, Isabell Baldauf <isabell...@gmail.com> wrote:
 I have found my mistake. Thank you anyway :-)


--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.

Isabell Baldauf

unread,
Jan 12, 2016, 10:00:10 AM1/12/16
to Shiny - Web Framework for R
Yes exactly that was my mistake. Thanks Isabell

prer...@gmail.com

unread,
Jun 5, 2017, 10:55:19 AM6/5/17
to Shiny - Web Framework for R
Hello Madlene,

Were you able to deploy Shiny app, using Oracle database?
Reply all
Reply to author
Forward
0 new messages