Search code examples
rodbcsequelpro

ODBC Driver to Connect Sequel Pro to R


I'm attempting connect my Sequel Pro database to R. In Joseph Adler's "R in a Nutshell"- page 164- he lists various ODBC drivers for different databases, but I can't find one for Sequel Pro. Any help on which driver to use would be greatly appreciated.


Solution

  • I don't have a Sequel Pro database, but here are the steps you would likely follow:

    1. Install the proper ODBC driver (http://dev.mysql.com/downloads/connector/odbc/)
    2. Add the database as an ODBC DSN. This is available in Windows in Administrative Tools -> Data Sources (ODBC). (Enable by right-clicking on Start Menu, "Customize...", and select one of the display options under "System administrative tools".) Add the database under "File DSN" (most likely) or "User DSN".
    3. Use R to open ODBC connection:

      library(RODBC)
      dsn <- "this is the dsn assigned in the windows tool"
      db <- odbcConnect(dsn)
      sqlQuery(db, "select * from whatever")
      sqlSave(db, df)
      

    Data in df. Sorry I can't give you the exact process, but I don't have the necessary data.