My requirement is to build a Shiny application that connects once and only once to the database, when the application is launched. If the database times out the connection, that is fine. Similarly, when a user closes the window, the database connection should be closed. This Shiny application has a Submit button that will do a CRUD operation depending on other form inputs.
In what section of a Shiny application can I handle application launch and termination so that I can connect and close database connection correspondingly?