0

I need to input username and password in an R code without values being shown in console. I am encrypting the variables to ensure it is not visible in the variable list. As I need to demo the code it is not helpful if the password pops up in the console. Can it be replaced by # or * for security for the demo

key <- PKI.genRSAkey(2048)
uid <- PKI.encrypt(charToRaw(readline("Enter userID: ")), key)
pwd <- PKI.encrypt(charToRaw(readline("Enter Password: ")), key)
drv <- JDBC(driverClass="org.netezza.Driver", classPath = "C:/JDBC/nzjdbc.jar", "'")
conn <- dbConnect(drv, "jdbc:netezza://netezzaprd01:5480/SDSNZD10", rawToChar(PKI.decrypt(uid, key)), rawToChar(PKI.decrypt(pwd, key)))

Any help appreciated. Thanks

Ishan Basu
  • 181
  • 1
  • 1
  • 12
  • I would put all this stuff in a separate .R and then call it with `source()` in your main r script – Dambo Aug 04 '16 at 02:02

1 Answers1

2

Have you tried creating a secure folder and putting a text file in it with your logon credentials? You could just call that and reference the inputted variables in your connection string.

Just not sure if it will come up in the console when you connect or not..

plumbus_bouquet
  • 443
  • 6
  • 7