Connection to MySQL (3.51) fail

Posted on 2011-04-27
Last Modified: 2012-05-11
Program (which is made using vs 2010) should take connection to intranet -server where
mysql database is located.
I've installed mysql-connector-odbc-3.51.28-winx64 to client computer and
connectionstring is:
"Driver={MySQL ODBC 3.51 Driver} ;Server=intraServer ;Port=3306;Option=3;Stmt=;Database=mydatabase;UID=root;"

But.. this connectionstring works if program is installed to windows 7 32bit but not using windows 7 64bit.

Does it matter that database -server is windows 2000 32bit?
Question by:d0nMaTTi
    LVL 11

    Expert Comment

    Only the driver that you install needs to be specific to the operating system platform. Install the 32-bit connector for installation on 32-bit Windows and the 64-bit one for the 64-bit version.

    Secondly, you also need to make sure that when you create the data source that you are creating it in the 64-bit ODBC repo (settings are stored in the registry of which 64-bit Windows machines have two, a 32-bit one and the 64-bit one). Depending on the platform of the application trying to use the data source (32 or 64) it will try access to corresponding registry. It will always work on 32-bit Windows cause the data source will only ever be created in one registry, the 32-bit one.
    LVL 11

    Accepted Solution

    To clarify some more, to access the 64-bit registry use C:\Windows\regedit.exe to access the 32-bit registry use C:\Windows\SysWOW64\regedit.exe

    On the 64-bit system that cannot connect to the database, check if the application is running as a 32-bit application or a 64-bit one. (* 32 next to the process in Task Manager means it 32-bit).

    Depending on the architecture it's using, go to the registry version in question and look for the key: HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI If you don't see a sub key there with the name of your data source then your app is not finding it either. You can easily export the key and just import into the other registry to make life easier.

    Welcome to the wacky world of 64-bit hybrid operating systems!

    Author Comment

    "..wacky world of 64-bit .." indeed.

    My computer is win 7 home pre 64 bit and
    I created system dsn link (control panel-->admin.tool --> ODBC)  and connection to local database seems to be correct. Then I did put "Dsn=myDNSTes;Uid=root" to odbc-connectionstring.
    When I tested query using that connection it takes more than 20 secons running simpe sql-query.

    Same query using sqlyog - takes 0,02 second. This is amazing.

    And after this ... every querys from program (using System.Data.Odbc -library) takes times
    but under sqlyog everything works fine.
    Is this  associated with windwos 64-bit registry.

    Before dns -testing HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI had not sub key and queries
    works fine. After testing I found sub key Data Source...
    I removed it but it had't  effect.

    Is there simple way to restore/clear odbc-settings to original.

    LVL 11

    Assisted Solution

    SQLyog will be using it's own native connection protocol which will be fast. Your app will be going through ODBC which is a generic driver and more than likely opening a connection for each call (where SQLyog just keeps on open) which will be considerably slower.

    It's beyond me why your queries are taking THAT long though but I doubt it's anything to do with the fact that you are running on a 64-bit OS. I would also stick to the ODBC control panel to configure your connections.

    But it sounds like your connection is working now, so the performance issue would be another problem altogether.

    Author Closing Comment

    Now connection works but it's overly complicated way
    when need to edit registry.

    Thansk a lot for advices.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    So many times I have seen the words written in a question "if only I could show you" or " I know how hard it is for you since you can't see it" in any zone. That has inspired me to write about this tool in windows 7 called "Problem Steps Recorder…
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
    This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now