I want to insert my output of app to my sql database, i have succesfully made connection between database and shiny app here is my code

library(shiny) library(DBI) ui <- fluidPage( textInput("id", "Enter your ID:", "1"), tableOutput("tbl") ) server <- function(input, output, session) { output$tbl <- renderTable({ conn <- dbConnect( drv = RMySQL::MySQL(), dbname = "shiny_database", host = "r.cr7lk1jwjdht.us-east-2.rds.amazonaws.com", username = "kartik", password = "12345678") on.exit(dbDisconnect(conn), add = TRUE) query <- paste0("INSERT INTO db(id2 , id ) VALUES ('13','43') ") # dbGetQuery(conn, query) # query <- paste0("SELECT * FROM db WHERE id = '", input$id, "';") dbGetQuery(conn, query) }) } shinyApp(ui, server)

Here i can insert my data by using insert query but when i have huge output data to insert , in that case i cannot use insert query again and again. Can anyone help me how i can insert my data. After searching i also find that there is temp folder in which output is store temporary, if it is possible that i can use temp folder for putting data in database.