Search code examples
mysqlvb6windowodbc

VB6 connecting to MySQL5.7.16 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


I compiled my VB.exe program on a PC and run it on a Window Server 2012R2 server as I can't install VB6 at the server.

I can't establish the following connection.

sDatabase = "DRIVER={MySQL ODBC 5.3 Unicode Driver};"
sDatabase = sDatabase & "Server=127.0.0.1;Port=3307;UID=root;Password=Pass;Database=Database;OPTION=3;"

Set gConn = New ADODB.Connection
gConn.Open sDatabase

I got the following error

error

I am sure that all the parameters are correct because I have another ASP Classic webpage that connects to MySQL successfully.

I don't know where to start debugging. Is it got to do with the following?

DNS


Solution

  • The answer is in your last screenshot, look at the title of the ODBC dialog. It states (64-bit). Use this one to access the 32-Bit version of ODBC:

    c:\Windows\SysWOW64\odbcad32.exe.

    And look here for details:

    https://blogs.msdn.microsoft.com/farukcelik/2008/10/17/why-my-32-bit-applications-cannot-see-the-odbc-dsns-that-i-created-on-my-64-bit-machine/