“Does anyone have experience connecting to a secure database that requires an SSH connection to a specific server? If so, is it possible to connect to secured database server connection using database libraries like SQLx?”
I tried Google but couldn't find any relevant results, Would appreciate some example/guidance/pointers. Thanks
My goal is to automate some tasks using Rust, which requires SSH tunnel integration in my code. I adhere to the existing rules for using DBeaver, which is the standard configuration at my workplace.
I think that creating an SSH tunnel and connecting to a database are orthogonal tasks and you can solve these independently.
1/ First, find how to create a SSH tunnel using openssh commands (for example; there are tutorials about this on the internet depending on what your OS is).
2/ Second, use a rust library that can talk to MySql just as you would use it for a local connection, but instead point it to the port that you just created a SSH tunnel to (the "entry" of the tunnel, if you will).
Finally, if you need everything to be in rust, you can think about how to move point 1/ from a bash script to calling openssh from your rust program.