Bug #48880 Feature Request: ODBC Connect via SSH Tunnel
Submitted: 18 Nov 2009 20:08 Modified: 19 Nov 2009 14:52
Reporter: Alex Chesser Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / ODBC Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: ODBC, ssh

[18 Nov 2009 20:08] Alex Chesser
Description:
Request the ability to use a SSH "Tunnel" to connect to a remote database.

How to repeat:
This is a feature request.  Try to connect via a SSH tunnel and you will not be able to.  The functionality does not exist.  Doh! 

Suggested fix:
A new tab within the advanced options of the ODBC connector dialogue.  (/setupgui/windows/odbcdialogparams.cpp)

Entitled SSH.  With the following options:

"SSH Tab"
- use SSH Tunnel = "checkbox"
- Host = "text box"
- Port = "text box"
- ssh username = "text box"
- authentication method  = DROPDOWN ->public key OR password
- Password = "password box"
- Save Password = "checkbox"
- Private Key = (path to file)
- passphrase = "password box"
- save passphrase = "check box"

When the "USE TUNNEL" box is checked it will force the connector to use an SSH session to connect to the server specified under HOST, where the MySQL connection will be run as if "local" to that specified machine. 

The details on how to connect (via windows) with SSH is documented here:
http://dev.mysql.com/doc/refman/5.1/en/windows-and-ssh.html

The following two links:
http://www.netsieben.com/products/ssh/
http://www.example-code.com/sshLibrary.asp 
http://www.example-code.com/vcpp/ssh_tunnel.asp
Contain example code of SSH in Action.

The first link is a library available under the Q public license, I couldn't tell what the license for 2 & 3 are.

SSH is further explained here: http://www.cknotes.com/?p=125
[19 Nov 2009 14:22] Tonci Grgin
Hi Alex and thanks for your report.

I am sorry but I don't follow you.
Can't you use putty or tunnelier to establish SSH session with port mapping and then just connect via ODBC?
Or do you want us to create tunnel for you? If this is the case, I think it's not reasonable to introduce such amount of code into driver to perform function that you can easily mimic with free software...
[19 Nov 2009 14:48] Alex Chesser
Thanks for looking into it Tonci  :)

In this case, it's more out of concern for the end user than for myself.  The reason I'm looking into it is because I'm developing applications for an office where the users don't necessarily want that level of complexity at the 'typical desktop' level. 

Essentially the ODBC connection will be a DSN or "connect string" in an Excel, Access or VBA application (as an example, obviously it applies to any ODBC connection).  

With a fully realized SSH tunnel option available, the connectivity would be virtually seamless to the end users.

I'd love for my end users to be able to install the driver once and click the "get external data" button in excel and be done with updating their report.

The alternative of requiring they install the driver, install PuTTY, set up port forwarding, run PuTTY, log in, *THEN* click the refresh button on excel.   Puts the reporting back in the realm of "just run it for me".

I personally think it would be an excellent feature to include within the driver itself.
[19 Nov 2009 14:52] Tonci Grgin
Alex, I am sorry but linking SSH client to driver does not appear to be an option at this moment (or even at all).
Check Bitvise Tunnelier or something with better user interface than PuTTY, configure it and distribute together with your installation.
[22 Oct 2012 17:03] Michael Magistro
Adding this feature would be excellent.  I used a shared folder to store reports for the company.  Problem is that we are located all around the world.  It would help out a ton if the excel file could connect via SSH using only ODBC (without needing some 3rd party software like tunnelier or putty).  

As it stands, I have to use my computer to SSH into the server using tunnrelier, then I have to update the file every 30 minutes so the company has real-time data.  I can't expect those I work with who are not tech-oriented to configure tunnelier and the odbc drivers...