Hi I'm trying to connect to MySql with the SSH-protocol. I'm using the code below, but I get an error at then line: conDBAccess.SshOptions.User = "tunnel"
The error says: Object reference not set to an instance of an object.
What is wrong. I've done exactly like shown in the Documentation.
Shared Function BuildConnStr() As String
Dim strConn As String = "host=localhost;protocol=SSH;user=jisdb;password=password;Database=iis"
Return strConn
End Function
'MySql
Public Shared Function objdbConnect() As MySqlConnection
Dim conDBAccess As MySqlConnection = New MySqlConnection(BuildConnStr())
conDBAccess.SshOptions.User = "tunnel"
conDBAccess.SshOptions.Password = "password"
conDBAccess.SshOptions.Host = "192.168.100.193"
Return conDBAccess
End Function
SSH - connection problem
It still wont work. I've now made this:
Dim conDBAccess As MySqlConnection = New MySqlConnection(BuildConnStr())
conDBAccess.SshOptions = New SshOptions("192.168.100.193", "username", "password")
Now I get the message: Can't connect to MySql server on localhost.
There isn't any communication/traffic with the server at all !!
The IP is correct. I can connect to the server with putty and the same user/password.
What is wrong. I need this to work ... pleeeease !
Bumasoftware
Dim conDBAccess As MySqlConnection = New MySqlConnection(BuildConnStr())
conDBAccess.SshOptions = New SshOptions("192.168.100.193", "username", "password")
Now I get the message: Can't connect to MySql server on localhost.
There isn't any communication/traffic with the server at all !!
The IP is correct. I can connect to the server with putty and the same user/password.
What is wrong. I need this to work ... pleeeease !
Bumasoftware
Here is the example of connection string I've tested:
Code: Select all
host=server;user=usr;password=psw;database=test;port=3306;ssh host=sshServ;ssh user=sshUser;ssh password=sshPsw;protocol=SSH;