MySQL connection string using SSH

Started by stevengraff, March 06, 2014, 05:56:53 AM

Previous topic - Next topic

stevengraff

I'm presently using:

cConn = 'DRIVER={MySQL ODBC %mySqlVersion% Driver};SERVER=%serverName%;DATABASE=%dbname%;UID=%userName%;PWD=%userPW%;OPTION=3;'   
DB    = ObjectCreate("ADODB.Connection") 
RS    = ObjectCreate("ADODB.Recordset")   
DB.Open(cConn)

and it works just fine. But now my client is concerned about security. How can I adjust this to include the parameters for SSH?

I think I need to include the SSH host name (which will be the %serverName% used above), ssh user id, ssh password, and ssh port. And change the server= parameter above to localhost.

Anyone familiar with the syntax? Do the parameters all go on the one line? or is there another way to connect?

Thanks,
SG

Deana

I recommend checking out the website http://www.connectionstrings.com. It is a great resource for these types of questions. Here is a link to the connection string sample using SSL:

https://www.connectionstrings.com/mysql-connector-odbc-5-1/using-ssl/
Deana F.
Technical Support
Wilson WindowWare Inc.

td

SSL certainly is the better approach but if that is not a possibility for some reason, there might be a way to connect using SSH.  It would require setting up a SSH port proxy on client system and then modifying the connection string to point to 'localhost' as the server and add a 'port=xxx'. 'Xxx' being the port number of the proxy port. 

Setting up the port proxy could possibly be done using a tool like putty or a third party dotNet assembly.   

Note that while I have some familiarity with SSH, I have never tried using an SSH proxy port to connect to a DB so I don't know that it would actually work. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stevengraff

Here's why I thought SSH might be easy...

The gui connection/management program called MySQL Workbench makes it drop-dead simple through their gui. (See attached, regular vs. SSH connection spec.) So, I figured "how hard could it be using Winbatch commands?" :)


Deana

I would suspect it would be easy using winbatch too... assuming you have the correct connection string. Again, I recommend checking out the website http://www.connectionstrings.com. It is a great resource for these types of questions. Here is a link to the connection string sample using SSL:

https://www.connectionstrings.com/mysql-connector-odbc-5-1/using-ssl/
Deana F.
Technical Support
Wilson WindowWare Inc.

stevengraff

Well, it looks like ssl is do-able, but not ssh.

For ssh, from what I've read, you need to make the machine-to-machine connection first, using SSH, then connect to MySQL, in a second distinct step.

Deana

Quote from: stevengraff on April 25, 2014, 09:25:20 AM
Well, it looks like ssl is do-able, but not ssh.

For ssh, from what I've read, you need to make the machine-to-machine connection first, using SSH, then connect to MySQL, in a second distinct step.

Ah yes, apparently need to hone my reading skills ( and drink more coffee ). I personally have never worked with SSH but the following ssh.net library looks interesting: https://sshnet.codeplex.com/
Deana F.
Technical Support
Wilson WindowWare Inc.

td

Quote from: stevengraff on April 24, 2014, 08:06:31 PM
Here's why I thought SSH might be easy...

The gui connection/management program called MySQL Workbench makes it drop-dead simple through their gui. (See attached, regular vs. SSH connection spec.) So, I figured "how hard could it be using Winbatch commands?" :)

Basing a task's underlying difficulty on the appearance of some UI is a little like assuming that nuclear power plants are easy to build because you get light when you flip the light switch.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stevengraff

Maybe so, but... I've seen Winbatch elegantly finesse it's way through so many nuke plants over the years, well, I s'pose I'm a little spoiled. Btw, when I was an engineering student at UMich a few decades ago, I had a co-op job working on the design of... a nuclear power plant. :)

JTaylor



td

Quote from: stevengraff on April 29, 2014, 09:43:03 AM
Maybe so, but... I've seen Winbatch elegantly finesse it's way through so many nuke plants over the years, well, I s'pose I'm a little spoiled. Btw, when I was an engineering student at UMich a few decades ago, I had a co-op job working on the design of... a nuclear power plant. :)

I know WinBatch is currently used by a nuclear power plant operator but not to sure it has ever been used to build one.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade