Page 1 of 2

connection problem using HTTP tunneling

Posted: Thu 11 Mar 2010 23:11
by msdev
I'm looking at using DotConnect to connect to MySql with HTTP tunneling. Following the documentation I'm using the same parameters (URL, User etc) as I set up in Navicat which connects fine. I get the following from an Exception when calling Open() on the MySqlConnection () : 'Can't connect to MySQL server on 'localhost' (10061): Can't establish HTTP connection.'. Here's the code:

MySqlConnection() sqlConnectionTarget = new MySqlConnection();
sqlConnectionTarget.ConnectionString = "Host=localhost;port=3306;user=xxxx;password=xxxx";
sqlConnectionTarget.Protocol = MySqlProtocol.Http;
sqlConnectionTarget.HttpOptions.Url = @"xxxx/ntunnel_mysql.php";
sqlConnectionTarget.HttpOptions.User = "xxxx";
sqlConnectionTarget.HttpOptions.Password = "xxxx";


I've been over it a few times, referencing the documentation and checking all the values against the connection properties I have set up in Navicat which works every time. Any ideas?

Posted: Fri 12 Mar 2010 10:05
by StanislavK
Please set the absolute path to the host in the Host property of the connection string. If you are using "localhost" instead, then the computer where ntunnel_mysql.php is installed won't be able to connect to the database.

Please inform us if this helped.

Posted: Fri 12 Mar 2010 10:51
by msdev
Thanks for that StanislavK - not sure what you mean by using an absolute path to the host in the connection string instead of localhost. Could you give an example?

Edit - I've tried using the machine name in the Host area of the connection string but still receive the same error.

Posted: Mon 15 Mar 2010 08:39
by StanislavK
You are right, the machine name or the IP address should be used as the Host property of the connection string.

Also, please try using the tunnel.php script, which is available in
%Program files%\Devart\dotConnect\MySQL\HTTP\ ,
instead of ntunnel_mysql.php.

Please see the corresponding topic of our documentation for details:
http://www.devart.com/dotconnect/mysql/ ... tml#tunnel

Posted: Mon 15 Mar 2010 22:25
by msdev
Right - using that file now. The error I'm getting is different:

Can't connect to MySQL server on '*****' (10061): Authentication failed.

So the host name seems to be correct, if I change it to anything other than the machine name or localhost, or alter the port I'm back to 'cannot establish HTTP connection'. Just seems it can't connect to MySql at this point. The User and Pass in the connection string should be correct though.

Posted: Tue 16 Mar 2010 09:43
by StanislavK
Please check that both credential sets are used in proper places. That means that user/password parameters should be set to credentials for MySQL server and HttpOptions.User/HttpOptions.Password should be used for the website folder with the tunnel.php script.

Also, please note that the "Authentication failed" message may signalize about any error that occurred during the authentication. You may send us the httptunnel_server.html log file, which is located in the same directory as tunnel.php, so that we are able to investigate the problem in details.

Posted: Mon 01 Nov 2010 07:08
by anisbd
Thanks to msdev and StanislavK.

I am fall in same problem as like msdev .
I am using dotConnect for MySQL 6.0 Beta.

Code: Select all

using Devart.Data;
using Devart.Data.MySql;


MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "server=localhost;uid=xxxxx;pwd=xxxxx";
conn.Protocol = MySqlProtocol.Http;
conn.HttpOptions.Url = "http://www.xxxxxxxxx.com/tunnel.php";
conn.Open();

I am getting following error -
Can't connect to MySQL server on 'localhost' (10061): Authentication failed.

httptunnel_server.log contains following massage -

Code: Select all

01.11.2010 02:01:48 - Connected to remote  localhost: 3306
01.11.2010 02:01:48 - Waiting for client...
01.11.2010 02:01:48 - 532994 52786
01.11.2010 02:01:49 - Client accepted
01.11.2010 02:01:49 - Client: Reading from server script
01.11.2010 02:01:49 - Read from client (1): r
01.11.2010 02:01:49 - Script liftetime incremented with 180
01.11.2010 02:01:49 - Read from remote:(70)
01.11.2010 02:01:49 - Write to client(70): B���
5.0.90-community-log�.�c�Cs<p?*TF�,�!��������������EdJ$q3HO4W8R�
01.11.2010 02:01:49 - Client: Read from server 70
01.11.2010 02:01:49 - Waiting for client...
01.11.2010 02:01:49 - Client accepted
01.11.2010 02:01:49 - Client: Reading from server script
01.11.2010 02:01:49 - Read from client (1): r
01.11.2010 02:01:49 - Script liftetime incremented with 180
01.11.2010 02:01:58 - Read from remote:(0)
01.11.2010 02:01:58 - Nothing to read from remote.
01.11.2010 02:01:58 - Write to client(0): 
01.11.2010 02:01:58 - Waiting for client...
01.11.2010 02:01:58 - Client: Read from server 0
01.11.2010 02:01:58 - Client: Reading from server script
01.11.2010 02:01:58 - Client accepted
01.11.2010 02:01:58 - Read from client (1): r
01.11.2010 02:01:58 - Script liftetime incremented with 180
01.11.2010 02:01:58 - Read from remote:(0)
01.11.2010 02:01:58 - Nothing to read from remote.
01.11.2010 02:01:58 - Write to client(0): 
01.11.2010 02:01:58 - Client: Read from server 0
01.11.2010 02:01:58 - Waiting for client...
01.11.2010 02:01:59 - Client: Reading from server script
01.11.2010 02:01:59 - Client accepted
01.11.2010 02:01:59 - Read from client (1): r
01.11.2010 02:01:59 - Script liftetime incremented with 180
01.11.2010 02:01:59 - Read from remote:(0)
01.11.2010 02:01:59 - Nothing to read from remote.
01.11.2010 02:01:59 - Write to client(0): 
01.11.2010 02:01:59 - Client: Read from server 0
01.11.2010 02:01:59 - Waiting for client...
01.11.2010 02:01:59 - Client: Reading from server script
01.11.2010 02:01:59 - Client accepted
01.11.2010 02:01:59 - Read from client (1): r
01.11.2010 02:01:59 - Script liftetime incremented with 180
01.11.2010 02:01:59 - Read from remote:(0)
01.11.2010 02:01:59 - Nothing to read from remote.
01.11.2010 02:01:59 - Write to client(0): 
01.11.2010 02:01:59 - Waiting for client...
01.11.2010 02:01:59 - Client: Read from server 0
01.11.2010 02:02:00 - Client: Reading from server script
01.11.2010 02:02:00 - Client accepted
01.11.2010 02:02:00 - Read from client (1): r
01.11.2010 02:02:00 - Script liftetime incremented with 180
01.11.2010 02:02:00 - Read from remote:(0)
01.11.2010 02:02:00 - Nothing to read from remote.
01.11.2010 02:02:00 - Client: Read from server 0
01.11.2010 02:02:00 - Write to client(0): 
01.11.2010 02:02:00 - Waiting for client...
01.11.2010 02:02:01 - Client accepted
01.11.2010 02:02:01 - Client: Reading from server script
01.11.2010 02:02:01 - Read from client (1): r
01.11.2010 02:02:01 - Script liftetime incremented with 180
01.11.2010 02:02:01 - Read from remote:(0)
01.11.2010 02:02:01 - Nothing to read from remote.
01.11.2010 02:02:01 - Write to client(0): 
01.11.2010 02:02:01 - Client: Read from server 0
01.11.2010 02:02:01 - Waiting for client...
01.11.2010 02:02:01 - Client: Reading from server script
01.11.2010 02:02:01 - Client accepted
01.11.2010 02:02:01 - Read from client (1): r
01.11.2010 02:02:01 - Script liftetime incremented with 180
01.11.2010 02:02:01 - Read from remote:(0)
01.11.2010 02:02:01 - Nothing to read from remote.
01.11.2010 02:02:01 - Write to client(0): 
01.11.2010 02:02:01 - Waiting for client...
01.11.2010 02:02:01 - Client: Read from server 0
01.11.2010 02:02:02 - Client: Reading from server script
01.11.2010 02:02:02 - Client accepted
01.11.2010 02:02:02 - Read from client (1): r
01.11.2010 02:02:02 - Script liftetime incremented with 180
01.11.2010 02:02:02 - Read from remote:(0)
01.11.2010 02:02:02 - Nothing to read from remote.
01.11.2010 02:02:02 - Client: Read from server 0
01.11.2010 02:02:02 - Write to client(0): 
01.11.2010 02:02:02 - Waiting for client...
01.11.2010 02:02:02 - Client accepted
01.11.2010 02:02:02 - Client: Reading from server script
01.11.2010 02:02:02 - Read from client (1): r
01.11.2010 02:02:02 - Script liftetime incremented with 180
01.11.2010 02:02:02 - Read from remote:(0)
01.11.2010 02:02:02 - Nothing to read from remote.
01.11.2010 02:02:02 - Write to client(0): 
01.11.2010 02:02:02 - Waiting for client...
01.11.2010 02:02:02 - Client: Read from server 0
01.11.2010 02:02:03 - Client accepted
01.11.2010 02:02:03 - Client: Reading from server script
01.11.2010 02:02:03 - Read from client (1): r
01.11.2010 02:02:03 - Script liftetime incremented with 180
01.11.2010 02:02:03 - Read from remote:(0)
01.11.2010 02:02:03 - Nothing to read from remote.
01.11.2010 02:02:03 - Write to client(0): 
01.11.2010 02:02:03 - Waiting for client...
01.11.2010 02:02:03 - Client: Read from server 0
01.11.2010 02:02:03 - Client: Reading from server script
01.11.2010 02:02:03 - Client accepted
01.11.2010 02:02:03 - Read from client (1): r
01.11.2010 02:02:03 - Script liftetime incremented with 180
01.11.2010 02:02:03 - Read from remote:(0)
01.11.2010 02:02:03 - Nothing to read from remote.
01.11.2010 02:02:03 - Client: Read from server 0
01.11.2010 02:02:03 - Write to client(0): 
01.11.2010 02:02:03 - Waiting for client...
01.11.2010 02:02:04 - Client accepted
01.11.2010 02:02:04 - Read from client (1): x
01.11.2010 02:02:04 - Script liftetime incremented with 180
01.11.2010 02:02:04 - Shutting down on client request.
01.11.2010 02:02:04 - Server script closed.
Note : I am testing http://www.xxxxxxxx.com/SQLyogTunnel.php using SQLyog this tunnel was connected successfully.

Please help me...

Posted: Tue 02 Nov 2010 10:24
by StanislavK
Apparently, the problem occurs when validating the credentials after connection to the server was established. Please check that you are able to connect to this MySQL server directly (i.e., not via the HTTP tunnel) using some standard tool. Also, please use the DNS name or IP of the machine where the MySQL server is installed instead of 'localhost' in the connection string (note that for tunnel connections 'localhost' means the machine where the script is installed).

Besides that, please check that the character set specified in the connection string is the same as the one used on the server.

Posted: Tue 02 Nov 2010 13:36
by anisbd
Thanks for your replay.
Please check that you are able to connect to this MySQL server directly (i.e., not via the HTTP tunnel) using some standard tool.
Yes, I am try using SQLYog but i can't connect(not via HTTP tunnel).

Error massage is "Error No. 2003
Can't connect to mysql server on xxxxxxx.com (10060)

"

In that server(www.xxxxxx.com) I already give permission for remote database access hosts ( like %).
Also, please use the DNS name or IP of the machine where the MySQL server is installed instead of 'localhost' in the connection string (note that for tunnel connections 'localhost' means the machine where the script is installed).
Besides that, please check that the character set specified in the connection string is the same as the one used on the server.

Code: Select all

MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "uid=xxxxx;pwd=xxxxxxx";
conn.Protocol = MySqlProtocol.Http;
conn.HttpOptions.Url = "http://www.xxxxxxxxx.com/tunnel.php";
conn.ConnectionTimeout = 300;
conn.Charset = "utf8";
conn.Host = "xxxxxxxxx.com";
conn.Open();

But i am fail again.......

UPDATE on 04-Nov-2010 :
I was tested on same PC (but another ISP (WIMAX)) . I was successfully connected. (not via HTTP tunnel)
Using following code I was connected via HTTP tunnel in same PC but another ISP (WIMAX).
MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "server=localhost;uid=xxxx;pwd=xxx";
conn.Protocol = MySqlProtocol.Http;
conn.HttpOptions.Url = "http://www.xxxxxx.com/tunnel.php";
conn.ConnectionTimeout = 300;
conn.Charset = "utf8";
conn.Open();
Now What's the problem... I think problem in ISP.
Please help me what can I do?

Note : Successfully connected using SQLyog (Both ISP) http://www.xxxxxxxx.com/SQLyogTunnel.php.

Posted: Thu 04 Nov 2010 13:01
by StanislavK
Please specify if you tried connecting with the previous ISP using these exact settings:

Code: Select all

MySqlConnection conn = new MySqlConnection(); 
conn.ConnectionString = "server=localhost;uid=xxxx;pwd=xxx"; 
conn.Protocol = MySqlProtocol.Http; 
conn.HttpOptions.Url = "http://www.xxxxxx.com/tunnel.php"; 
conn.ConnectionTimeout = 300; 
conn.Charset = "utf8"; 
As for the 'Can't connect to mysql server on xxxxxxx.com' problem when using the DNS name of the host, did you try setting

Code: Select all

conn.Host = "www.xxxxxxxxx.com";
or using the IP address? Please tell us if this helps.

Posted: Sun 07 Nov 2010 02:30
by anisbd
Please specify if you tried connecting with the previous ISP using these exact settings:
Code:

Code: Select all

MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "server=localhost;uid=xxxx;pwd=xxx";
conn.Protocol = MySqlProtocol.Http;
conn.HttpOptions.Url = "http://www.xxxxxx.com/tunnel.php";
conn.ConnectionTimeout = 300;
conn.Charset = "utf8"; 
Yes I used exact code with previous ISP.
but getting error.
Can't connect to MySQL server on 'localhost' (10061): Authentication failed.

As for the 'Can't connect to mysql server on xxxxxxx.com' problem when using the DNS name of the host, did you try setting
Code:

Code: Select all

conn.Host = "www.xxxxxxxxx.com";
but getting error.
Can't connect to MySQL server on 'www.xxxxx.com' (10061): Authentication failed.

Posted: Tue 09 Nov 2010 14:18
by StanislavK
It is possible that for some reason more time is needed to establish connection with the first ISP. Please try increasing the Connection Timeout property of the connection string when using this ISP. If the problem persists, please send us the .log file for the connection attempt with higher timeout and, if possible, the details and stack trace of the exception you are getting in your application.

Posted: Wed 10 Nov 2010 04:00
by anisbd
I was increased connection timeout but getting error. Can't connect to MySQL server on 'localhost' (10061): Authentication failed.

Code: Select all

MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "server=localhost;uid=xxxx;pwd=xxx";
conn.Protocol = MySqlProtocol.Http;
conn.HttpOptions.Url = "http://www.xxxxxx.com/tunnel.php";
conn.ConnectionTimeout = 2000;
conn.Charset = "utf8"; 

_connections.id.php detail information from server

Code: Select all

57747 976777 44241
963 825692 41580
810411 875371 52101
httptunnel_server.log

Code: Select all

09.11.2010 21:51:58 - Connected to remote  localhost: 3306
09.11.2010 21:51:58 - Waiting for client...
09.11.2010 21:51:58 - 810411 875371
09.11.2010 21:52:01 - Client: Reading from server script
09.11.2010 21:52:01 - Client accepted
09.11.2010 21:52:01 - Read from client (1): r
09.11.2010 21:52:01 - Script liftetime incremented with 180
09.11.2010 21:52:01 - Read from remote:(70)
09.11.2010 21:52:01 - Write to client(70): B   
5.0.90-community-log Ë$z a#(?EzZ4 ,¢!              4HL$m|G,DQLh 
09.11.2010 21:52:01 - Waiting for client...
09.11.2010 21:52:01 - Client: Read from server 70
09.11.2010 21:52:02 - Client accepted
09.11.2010 21:52:02 - Client: Reading from server script
09.11.2010 21:52:02 - Read from client (1): r
09.11.2010 21:52:02 - Script liftetime incremented with 180
09.11.2010 21:52:08 - Read from remote:(0)
09.11.2010 21:52:08 - Nothing to read from remote.
09.11.2010 21:52:08 - Write to client(0): 
09.11.2010 21:52:08 - Waiting for client...
09.11.2010 21:52:08 - Client: Read from server 0
09.11.2010 21:52:10 - Client accepted
09.11.2010 21:52:10 - Client: Reading from server script
09.11.2010 21:52:10 - Read from client (1): r
09.11.2010 21:52:10 - Script liftetime incremented with 180
09.11.2010 21:52:10 - Read from remote:(0)
09.11.2010 21:52:10 - Nothing to read from remote.
09.11.2010 21:52:10 - Write to client(0): 
09.11.2010 21:52:10 - Waiting for client...
09.11.2010 21:52:10 - Client: Read from server 0
09.11.2010 21:52:10 - Client: Reading from server script
09.11.2010 21:52:10 - Client accepted
09.11.2010 21:52:10 - Read from client (1): r
09.11.2010 21:52:10 - Script liftetime incremented with 180
09.11.2010 21:52:10 - Read from remote:(0)
09.11.2010 21:52:10 - Nothing to read from remote.
09.11.2010 21:52:10 - Write to client(0): 
09.11.2010 21:52:10 - Waiting for client...
09.11.2010 21:52:10 - Client: Read from server 0
09.11.2010 21:52:11 - Client: Reading from server script
09.11.2010 21:52:11 - Client accepted
09.11.2010 21:52:11 - Read from client (1): r
09.11.2010 21:52:11 - Script liftetime incremented with 180
09.11.2010 21:52:11 - Read from remote:(0)
09.11.2010 21:52:11 - Nothing to read from remote.
09.11.2010 21:52:11 - Write to client(0): 
09.11.2010 21:52:11 - Client: Read from server 0
09.11.2010 21:52:11 - Waiting for client...
09.11.2010 21:52:12 - Client accepted
09.11.2010 21:52:12 - Client: Reading from server script
09.11.2010 21:52:12 - Read from client (1): r
09.11.2010 21:52:12 - Script liftetime incremented with 180
09.11.2010 21:52:12 - Read from remote:(0)
09.11.2010 21:52:12 - Nothing to read from remote.
09.11.2010 21:52:12 - Write to client(0): 
09.11.2010 21:52:12 - Waiting for client...
09.11.2010 21:52:12 - Client: Read from server 0
09.11.2010 21:52:15 - Client: Reading from server script
09.11.2010 21:52:15 - Client accepted
09.11.2010 21:52:15 - Read from client (1): r
09.11.2010 21:52:15 - Script liftetime incremented with 180
09.11.2010 21:52:15 - Read from remote:(0)
09.11.2010 21:52:15 - Nothing to read from remote.
09.11.2010 21:52:15 - Write to client(0): 
09.11.2010 21:52:15 - Waiting for client...
09.11.2010 21:52:15 - Client: Read from server 0
09.11.2010 21:52:16 - Client accepted
09.11.2010 21:52:16 - Client: Reading from server script
09.11.2010 21:52:16 - Read from client (1): r
09.11.2010 21:52:16 - Script liftetime incremented with 180
09.11.2010 21:52:16 - Read from remote:(0)
09.11.2010 21:52:16 - Nothing to read from remote.
09.11.2010 21:52:16 - Write to client(0): 
09.11.2010 21:52:16 - Client: Read from server 0
09.11.2010 21:52:16 - Waiting for client...
09.11.2010 21:52:17 - Client accepted
09.11.2010 21:52:17 - Client: Reading from server script
09.11.2010 21:52:17 - Read from client (1): r
09.11.2010 21:52:17 - Script liftetime incremented with 180
09.11.2010 21:52:17 - Read from remote:(0)
09.11.2010 21:52:17 - Nothing to read from remote.
09.11.2010 21:52:17 - Write to client(0): 
09.11.2010 21:52:17 - Waiting for client...
09.11.2010 21:52:17 - Client: Read from server 0
09.11.2010 21:52:18 - Client accepted
09.11.2010 21:52:18 - Client: Reading from server script
09.11.2010 21:52:18 - Read from client (1): r
09.11.2010 21:52:18 - Script liftetime incremented with 180
09.11.2010 21:52:18 - Read from remote:(0)
09.11.2010 21:52:18 - Nothing to read from remote.
09.11.2010 21:52:18 - Write to client(0): 
09.11.2010 21:52:18 - Client: Read from server 0
09.11.2010 21:52:18 - Waiting for client...
09.11.2010 21:52:19 - Client accepted
09.11.2010 21:52:19 - Client: Reading from server script
09.11.2010 21:52:19 - Read from client (1): r
09.11.2010 21:52:19 - Script liftetime incremented with 180
09.11.2010 21:52:19 - Read from remote:(0)
09.11.2010 21:52:19 - Nothing to read from remote.
09.11.2010 21:52:19 - Write to client(0): 
09.11.2010 21:52:19 - Waiting for client...
09.11.2010 21:52:19 - Client: Read from server 0
09.11.2010 21:52:20 - Client: Reading from server script
09.11.2010 21:52:20 - Client accepted
09.11.2010 21:52:20 - Read from client (1): r
09.11.2010 21:52:20 - Script liftetime incremented with 180
09.11.2010 21:52:20 - Read from remote:(0)
09.11.2010 21:52:20 - Nothing to read from remote.
09.11.2010 21:52:20 - Write to client(0): 
09.11.2010 21:52:20 - Client: Read from server 0
09.11.2010 21:52:20 - Waiting for client...
09.11.2010 21:52:21 - Client accepted
09.11.2010 21:52:21 - Read from client (1): x
09.11.2010 21:52:21 - Script liftetime incremented with 180
09.11.2010 21:52:21 - Shutting down on client request.
09.11.2010 21:52:21 - Server script closed.
09.11.2010 21:52:38 - Client accepted
09.11.2010 21:52:38 - ERROR: Bad client.
09.11.2010 21:52:38 - Waiting for client...
09.11.2010 21:52:46 - Client accepted
09.11.2010 21:52:46 - ERROR: Bad client.
09.11.2010 21:52:46 - Waiting for client...
Following massage shown in my immediate window

Code: Select all

A first chance exception of type 'Devart.Data.MySql.MySqlException' occurred in Devart.Data.MySql.dll

Posted: Fri 12 Nov 2010 16:21
by StanislavK
The probable cause of the issue is that the ISP anti-virus or filtering software modifies the credentials sent to the server. To check if this is the case, please create a user with a simple name and password consisting of Latin symbols only, say, User Id = user1, password = password1. Please try connecting with these credentials and the ISP with which the problem occurs. If you are able to connect, the problem is apparently caused by modification of credentials at the provider side. In this case please contact your ISP.

Posted: Sun 21 Nov 2010 04:05
by anisbd
Using password consisting of Latin symbols but i am getting same error

Code: Select all

conn.ConnectionString = "uid=xxxx;pwd=āāāāā1";
                conn.Protocol = MySqlProtocol.Http;
                conn.HttpOptions.Url = "http://www.xxxxx.com/tunnel.php";
                conn.ConnectionTimeout = 9000;
                conn.Charset = "utf8";
                conn.Open();
Remember that Successfully connected using SQLyog (Both ISP) http://www.xxxxxxxx.com/SQLyogTunnel.php.
But http://www.xxxxx.com/tunnel.php failed