Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • avoiding plain-text passwords in .do files?

    I'm connecting to a data warehouse using odbc load as shown below:
    odbc load, exec("my_SQL_statement") user(my_username) password($pass) dsn("my_data_source");
    As you can see, the password is supplied by a global macro, which I defined in profile.do. That's better than putting the plain-text password in each .do file, but still not good.

    (How) can I avoid having a plain-text password in Stata? I'm looking for something like SAS's proc pwencode, which supplies an encoded password or R's keyring::key_get that retrieves passwords from a system keyring.

    Thanks for any help you can provide!

  • #2
    I think you've hit on the only available strategy that I'm aware of. That is, keeping the plain-text password stored as a local or global in a separate file. Here you have used profile.do, but any such do-file will achieve the result by using -include-. Presumably you are in control of this password-containing file, so you can store it apart from your project files (especially if you are working in a collaborative setting). However, for anything fancier, that seems like a job for StataCorp.
    Last edited by Leonardo Guizzetti; 05 May 2022, 14:31.

    Comment


    • #3
      Java, or maybe Python, might be used for decryption and via API run the Stata odbc load command quietly.

      Comment

      Working...
      X