title: R SSH Tunnel MySQL
body: <p>I'm looking for a way that will allow me to use an SSH Tunnel to connect to a MySQL Server (as opposed to a file) within R; I'm assuming it'll require a combination of RCurl and RODBC, but I can't seem to get it to work properly.</p>
  
  <p>I came across <a href="https://stackoverflow.com/questions/2226867/can-r-read-from-a-file-through-an-ssh-connection">this post</a> and <a href="https://stackoverflow.com/questions/17347450/how-do-you-connect-to-a-remote-server-with-ssh-in-r/17347956#17347956">this post</a> that talk about utilizing SSH to connect to specific files or tables, but I'm hoping to use it as part of a Shiny app that will execute different SQL queries based on input from the user, which would require connecting into the server as opposed to specific files.  </p>
  
  <p>I'm assuming the code would look something along these lines <code>x = scp("remote.ssh.host.com", "/home/dir/file.txt", "My.SCP.Passphrase", user="username")</code>, but would I replace the <code>"/home/dir/file.txt"</code> piece with an <code>odbcConnect()</code> statement or replace it with the port number for the specific database I want to access?</p>
  
  <p>Edit: The line I use for a regular odbcConnect() is <code>odbcConnect(dsn, uid = "userid", pwd = "password")</code>.  Part of the problem is, I am developing it on Windows, but it will be deployed to a Linux server (handled be someone else) so I'm struggling to figure out what exactly will need to be used in my server.R code for connecting to the database.</p>