Page 1 of 1

cannot connect to my database :(

Posted: Tue 04 Mar 2014 19:24
by skippix
i'm really pulling my hair out on this.

i have a MySQL database hosted at bluehost. i am developing using Delphi XE5 and MyDAC 8.2.5.

i have 3 machines sharing a wifi router to get to the internet. i have written a dozen or so applications that can connect to my bluehosted database without any problems.

i installed one of these applications on another remote computer that i have access to via GoToMyPC. it simply will not connect.

on this remote computer i can both ping the server as well as connect to the database through the bluehost cpanel phpMyAdmin. but i cannot get my application to connect.

i wrote a simple connection application with nothing but a button, a label a TMyConnection, and a TMyConnectDialog. on my 3 machines it allows me to connect; on the remote machine, it won't connect.

here's btn's click code (it's the only code in the application)

Code: Select all

  if (MyConnection1.Connected) then
    MyConnection1.Disconnect;

  try
  MyConnection1.Connect;
    Label1.Caption := 'connected';
  except on e:exception do
    Label1.Caption := 'not connected: ' + e.Message;
  end;
help! i REALLY need this to work. what am i missing?

tia!

Re: cannot connect to my database :(

Posted: Wed 05 Mar 2014 09:45
by Dimon
Please check, that firewalls on the server permits access by MySql port (3306).
If this will not solve the problem, please specify the exact error message that arises in your application when it connects to a database.

Re: cannot connect to my database :(

Posted: Wed 05 Mar 2014 19:13
by skippix
Thanks for your response.

I built inbound and outbound rules for the firewall to allow access by port 3306, but the connection still fails.

Please see attached screenshot; let me know if you need any further information.

Thanks!
Image

Also, I have tested this on two more machines without any problems. I really don't understand what is causing this remote machine to fail to connect.

Re: cannot connect to my database :(

Posted: Thu 06 Mar 2014 14:23
by Dimon
Given error arises when the connected host has failed to respond. You can read about the WSAETIMEDOUT(10060) error in more details in MSDN.
Usually this error is related to network problems or firewall settings.
Try to connect with Telnet. If connection is established, you should check TMyConnection.Server and TMyConnection.Port properties.

Re: cannot connect to my database :(

Posted: Thu 06 Mar 2014 14:32
by skippix
Unfortunately, I have resolved the problem, and it has nothing to do with devart or MyDAC :(

My host requires whitelisting all connecting IPs before allowing a connection to my database. To make it more challenging, this can't be automated - it must be done through their cpanel.

While I'll still get a lot of great use out of MyDAC, I've got to go back to the drawing board to figure out how to build and maintain a dynamic userbase. C'est la vie.

Anyways, thanks for your feedback. You can mark this case closed.

Re: cannot connect to my database :(

Posted: Fri 07 Mar 2014 09:44
by Dimon
MyDAC supports HTTP tunneling based on the PHP script. You can find detailed information about it in the "Network Tunneling" topic of MyDAC Help. It may help solve your issue.

Re: cannot connect to my database :(

Posted: Fri 07 Mar 2014 18:09
by skippix
I'm trying to get the tunneling to work, but need some help with the configuration.

I've uploaded the tunnel.php to my server. When I put the full address to the file in my FireFox address bar, I get the following (which I assume is good):

Code: Select all

Devart HttpTunnel v1.66
Tunnel script is installed correctly.
You can establish connections through the HTTP tunnel.
In my test program, I dropped another TMyConnection component and gave it the exact same properties as the other one, except that the second one has the full path to the tunnel.php in the URL property.

When I run the program from my network, everything is fine. When I run it from my remote machine (which does not have a whitelisted IP), it fails to connect, just as before.

What am I missing configuration-wise to make this work? As it doesn't appear to be a proxy issue (I'm guessing at that, simply because my whitelisted connection connects through Port 3306), I'm not sure what's keeping me from connecting.

Re: cannot connect to my database :(

Posted: Wed 12 Mar 2014 14:26
by Dimon
Please check that you set the TMyConnection.Options.Protocol property to mpHttp.

Re: cannot connect to my database :(

Posted: Wed 12 Mar 2014 18:05
by skippix
still NOT working...

i get the message 'Cannot establish HTTP connection'

can i email you the login and have you set the parameters and mail me back the component properties?

Re: cannot connect to my database :(

Posted: Thu 13 Mar 2014 13:39
by Dimon
We have answered you by e-mail.