How can I programmatically connect to a remote database server that requires an SSH tunnel?
-
20-09-2019 - |
Question
I'm working on an ETL using C# in which extracts data from a remote MySQL database that requires an SSH tunnel to connect. I currently have it working such that I first create my SSH tunnel manually using PuTTY and then programmaticly connect to the database normally using a MySqlConnection object, etc.
How can I programmatically create the SSH tunnel using C#/.NET? Are there any libraries for doing this and/or is anything built into the .NET framework itself that would aid me in doing this?
OTHER TIPS
- Create keys so you don't have to use a password for SSH.
- Do the proper SSH command with the proper arguments(for TCP forwarding)(calling an external EXE such as putty)
- Use the proper connections settings.
- Your done!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow