I am trying a simple Shiny -2- SQL connection example.
I have a UI where user enters a number (in this case ID #). Shiny then sends this to a SQL Query and then results from the Query are displayed back on the UI screen.
UI.r
shinyUI(fluidPage(
titlePanel("Test Case"),
sidebarLayout(
sidebarPanel((""),
textInput("mrnnumb", "Enter ID number",""),
submitButton("Ok")),
mainPanel(("Results"),
tableOutput("dis"))
)
))
server.r
library(RODBC)
library(sqldf)
myconn = odbcConnect("Test1", uid="12345", pwd="password123")
shinyServer(function(input, output) {
a1 = reactive({input$mrnnumb})
testq = reactive({ sqlQuery(myconn, paste("select DOB,GenderCode,MaritalStatus,IDNumber from Demographics_extended where IDNumber = '",a1,"'"))})
output$dis<-renderDataTable(testq)
})
The results are null...nothing is happening....no error..no message...nothing....Need some help