MySQL through a proxy server (General questions)
I was referred to you by MicroOLAP for the problem I'm trying to solve. I'm trying to get MicroOLAP's DAC for MySQL components to connect to a remote MySQL database when the client has to go through a proxy sever. Here's what I'm doing:
[code]
wodTunnel1.Hostname := 'my_mysql_server_hostname';
wodTunnel1.Login := 'demo';
wodTunnel1.Password := 'demo';
wodTunnel1.Port := 3306;
wodTunnel1.ProxyHostname := 'my_proxy_server_hostname';
wodTunnel1.ProxyPort := 8080;
wodTunnel1.ProxyType := ProxyWEBStandard;
wodTunnel1.Connect;
wodTunnel1.Channels.StopAll;
wodTunnel1.Channels.Add(LocalListen, 'localhost', 3306, 'my_proxy_server_hostname', 8080);
wodTunnel1.Channels.StartAll;
DB := TMySQLDatabase.Create(nil);
try
with DB do begin
LoginPrompt := False;
Host := 'my_mysql_server_hostname ';
Port := 3306;
Username := 'my_mysql_username';
UserPassword := 'my_mysql_password';
DatabaseName := 'my_database';
Connected := True;
end;
... do some other stuff here ...
finally
DB.Close;
DB.Free;
end;
[/code]
After calling Connect, I see my HTTP connection on the proxy server from my IP address. When I try to start all channels I get the error: Cannot start/stop channel, not connected to the server . Any ideas on what I'm doing wrong?
Re: MySQL through a proxy server
Damon,
I think that problem is when StopAll is called component is not yet connected. It takes time for it to connect. It's best to move StartAll to Connected event body.
After that you can start MySQL redirection. However, if both wodSSHTunnel and MYSQL Client live in same thread, that could block too.
Solution would be to move MySQL to another thread, or wodSSHTunnel to another thread, or set Threads = True in wodSSHTUnnel, or use wodSSHTunnel EXE.
Kreso