简体   繁体   中英

How to connect R-studio to Oracle Database and also add external file csv to the queried data for ShinyDashBoard in R?

Below is the scenario.

Scenario:
I am building ShinyDashBoard that will allow end users to track system usability at specific location.

For this I need two tables that are in Oracle Database (As explained below). Also,I have one csv file that I would like to join after data is queried. This csv file contains data regarding System location. The purpose of joining csv file is to retrieve data of all systems located at specific location. This csv file consist of System, Location columns . From end-user perspective they would like to see where all systems are located, and at what frequency are those system being used ?

Table1 consists of User login information. It consist of UserName, UserLogin Date columns

Table2 consist of data regarding which user is using which system.(This table does not contain data of all systems, it only contains data where the system is being currently used). This table consist of UserName and System column.

Question #1 : My question is how to approach in building the App ? I read this post where author suggest it's possible to connect to Oracle Database in R-Studio using RODBC package. However, I am not sure where should I put the code for connecting to Oracle database ? Does connection code goes in Global environment ? or does it go in Sever part of shiny App ?

Question #2 : How to join external data ? I know I can perform Join on my Table1 and Table2 on "UserName" column. Then I can perform Join on "System" column that is in csv file.Where should the code for Join go ?

Question #3 : Regarding username and password part of RODBC package.Since, end-users will be different persons using the app. What should I put for username and password when deploying the application?

I know this question covers various areas, if possible provide basic syntax of how would basic ShinyDashBoard app look like, which can connect to Oracle Database, and query the data from two table and perform join with external csv file,and render data on ShinyDashboard in form of visualization.

If it is Oracle you will need RJDBC package. https://cran.r-project.org/web/packages/RJDBC/index.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM