Saturday 15 February 2014

r - RODBC to SQL using credentials file (as opposed to clear text) -



r - RODBC to SQL using credentials file (as opposed to clear text) -

so works:

odbcconnect("testdb", "admin", "password")

but dont want username , pwd in clear text. figured write credentials text file , import file utilize with:

odbcconnect(textfile)

saving credentials , calling readlines(textfile) produces string escape characters throws connections:

"odbcconnect(\"testdb\", \"admin\", \"password\")"

i've tried legion of escape characters in text file , tried creating string using paste result comes version of line above. got workaround or safer way connect sql?

you can store variables in separate .r file. username = yourusername password = yourpassword dsn = yourdb

in script connect odbc can phone call script defines variables. source("variables.r")

sql r rodbc

No comments:

Post a Comment