How to connect dynamic IP in ODBC Driver using Visual Basic 6.0

Dani AI

Generated

Most likely this is a network/permission issue rather than an ODBC/VB6 bug. Error 10060 is a TCP timeout — a client cannot reach the MySQL TCP port. The fact that the app works when the machine uses the Tata static IP but fails on the BSNL dynamic IP strongly points to one of these: the MySQL server or its firewall only allows the static IP, the ISP or CGNAT used by BSNL blocks or translates outbound 3306 traffic, or DNS/hostname resolution differs between the two networks. observed the same behaviour; and correctly pointed out hostnames, but using a hostname will not fix firewall or host-grant restrictions.

Diagnostic checklist (quick tests):

  • Try TCP reachability:
    telnet your.mysql.host 3306

    or on Windows PowerShell:

    Test-NetConnection -ComputerName your.mysql.host -Port 3306
  • Try the native client:
    mysql -h your.mysql.host -u userid -p
  • Run tracert/traceroute to confirm routing and look for ISP/NAT issues.

Server-side settings to verify:

  • MySQL must be listening on the external interface (my.cnf/my.ini: bind-address not set to 127.0.0.1 and skip-networking disabled).
  • Firewall/NAT on the server must allow TCP port 3306 (or the chosen port) from the client.
  • MySQL account host must permit the connecting host (for example a wildcard host userid@% or explicit host/range). Example SQL to allow remote hosts:
    GRANT SELECT,INSERT,UPDATE ON databasename.* TO 'userid'@'%' IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;

    Security and practical fixes:

  • Whitelisting a frequently changing BSNL IP is impractical. Prefer an SSH tunnel or VPN to avoid exposing MySQL to the public Internet. Example SSH tunnel:
    ssh -L 3307:127.0.0.1:3306 user@mysql-server

    then point ODBC at localhost:3307. If the server itself has a dynamic IP, use a dynamic-DNS service or a VPN endpoint.

Recommended Answers

All 7 Replies

How to connect ODBC Driver with MySQL using dynamic IP internet connection in Visual Basic 6.0 application? I am getting error while connecting using [MySQL][ODBC 3.51 Driver] in Vb 6.0 application. I find that using static IP internet connection the application is working successfully but using dynamic IP internet connection occurs
error Description:-"[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server 10060"
and Error No:- "-2147467259". Actually we are using internet connection by "Tata Indicom internet service provider" and this is static IP internet connection and other connection is by "BSNL internet service provider" and this is dynamic IP internet connection.
Please help me as soon as possible.

why you need to connect dynamically to any IP ?

why you need to connect dynamically to any IP ?

Sorry you couldn't get my question. Actually my internet service provider giving us dynamic IP and we couldn't connect to MySQL server using that connection. But using another connection application is working properly.

try to use system anme instead of IP address for the connection.

what is "system anme"?

Set con_server = New ADODB.Connection
con_server.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
           & "SERVER=servername;" _
           & "DATABASE=databasename;" _
           & "UID=userid;" _
           & "PWD=password;" _
           & "OPTION=3"
con_server.Open

this code is working with "tata indicom internet connection provider" but while i using "bsnl internete connection provider "gives me error.
plese help me it is very urgent.

This is system name.... not system anme... U can use system name(server name) instead of IP address.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.