connect to oracle data base using source()

I can connect to our oracle data base via odbc like so:

odbcConnection <- DBI::dbConnect(odbc::odbc(),
                                 dsn = "OracleDSN",
                                 UID = Sys.getenv("Oracle_UID"),
                                 PWD = Sys.getenv("Oracle_PWD"))

The odbcConnection object gets created and in the Rstudio connections pane the data base list pops up.

I would like to do the same using source() where connect_to_oracle.R contains above code:

source(file path to connect_to_oracle.R)

No error, the odbcConnection object gets created and I can use it programmatically.

BUT: In the Rstudio connections pane the data base list does not pop up, nothing appears there.

Using R 3.6.0 and Rstudio Server Version 1.2.5001

Any ideas why that may be the case?

Thanks!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.