SSH start example.. ***PLEASE HELP****

May 30, 2012 at 7:49 PM

Hi all,

 

I really need help, I have been looking for help on any forum possible and still nothing.

 

I want to establish a SSH tunnel which I managed with the following code. Problem is when I execute mysql connection string and connection to the database. I get exeception about timeout meaning that server is refusing me to enter as I am not using secured connection. 

 

But how to tell my connection string that I am on secured tunnel? 

 

Here is my code:

using (var client = new SshClient("cpanel****", "******", "******"))
          {
            client.Connect();
            con = new MySqlConnection(GetConnectionString());
            con.Open();
            cmd = new MySqlCommand(String.Format("insert into {0} values (null, ?Parname , ?Parname2, ?Parname3, ?Parname4, ?Parname5, ?Parname6, ?Parname7);", ConfigSettings.ReadSetting("main")), con);
            cmd.Parameters.Add("?Parname", MySqlDbType.Double).Value = Math.Round(deciLat, 5);
            // ... more parameters
            cmd.ExecuteNonQuery();
            client.Disconnect();
           }
 Please give me some help!!

May 31, 2012 at 5:48 PM

Really? Not even one of you guys don't know how to help me. And I am sure it is trivial, I just need a push in right direction. Please help 

Coordinator
Jun 5, 2012 at 8:12 PM

Hi,

 

From the code example I dont see how and where you using client variable, other then connectig to the server.

 

I think you need to establish port forwarding or something else before connecting to database.

Hope it helps.

Thanks,

Oleg