Announcement

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

  • Accessing a remote MySQL database

    I'd normally connect to the database (and view all of the different tables) using Excel > Data > Get External Data > From Other Sources > From SQL Server. I'd much rather write some Stata code to automate accessing this database and selecting tables and variables.

    I've read the odbc help file, but I am stumped. The examples in the help file assume the database is on one's local machine. The database I'd like to access is located on a remote server that I access using a unique IP address, username, and password.

    Any advice?

  • #2
    As a former Windows user who has accessed database servers from desktop software, I'll hazard a guess, but please don't take this as authoritative in any way.

    I think you are going to need to seek help from your computing support group to configure an ODBC source in your Windows system settings to access the remote database. Once this is done, the documentation disgorged by Stata's help odbc should point you in the right direction. The username and password you were given correspond to connect_options of the same name. If you're daring, you might find do-it-yourself help for this task through Google, but there can often be technical constraints introduced by the computing environment.

    Actually, you can start by trying Stata's odbc list command to see if perhaps there already is a suggestively-named ODBC source configured on your Windows system.

    My bottom line is that I think the first step is to set up the ODBC source, which is part of Windows, not Stata, and so will require non-Stata support familiar with your computing environment.

    Comment


    • #3
      This is helpful, William. Much appreciated.

      Comment

      Working...
      X