I use the following to connect to a remote MySQL database via SSH
TMyConnection ---> TMySSHIOhandler ---> TScSSHclient ----> TScFileStorage
This seems to work as Wireshark shows encrypted packets.
Sometimes I don't want to use SSH so I delete the connection between TMyConnection and TMySSHIOhandler (this seems to work to stop a SSH connection,, even if its not the correct way to do it)
I have a number of questions
1)
My Delphi application logs all the user connections to the database in a table in the database.
Is there some property or method in any of the above components that will tell me if I am connected via SSH or not so I can log that fact as well? (this is very important as I need to use this in another area to do with IP address manipulation)
2) Is there a better way to 'turn on' and 'turn off' at runtime whether the connection uses SSH or not so I can decide whether or not to use it at runtime?
3)
I think I notice that if TScSSHclient,connected = false at design time and I then run the application, set TScSSHclient,connected := truem connect and then shut down the application, then at design time TScSSHclient,connected remains showing connected = true even though I last left it as false in design the last time. Am I just getting muddled here or is it really happening. If so why?
How to detect if I am connected to my DB by SSH or not?
Re: How to detect if I am connected to my DB by SSH or not?
When the TMyConnection.IOHandler property is set to TMySSHIOHandler, work with the server will always be carried out via the SSH protocol.
If you want to connect using a non-secure protocol, then you should set this property to nil. For example:
The value of the TScSSHclient.Connected component property does not depend in any way on actions in runtime.
If you want to connect using a non-secure protocol, then you should set this property to nil. For example:
Code: Select all
MyConnection.IOHandler: = nil;