Click here to Skip to main content
15,894,047 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Web.Config :
HTML
<add name="locator" connectionString="Driver={MySQL ODBC 5.3 ANSI Driver};SERVER=localhost;DNS=myDNS;Database=myDatabase;UID=root;OPTION=3" providerName="System.Data.Odbc" />


Behind code :
C#
using System.Data.Odbc;

string ConnectionString = ConfigurationManager.ConnectionStrings["locator"].ToString();
            
DbConnection = new OdbcConnection(ConnectionString);
                   DbConnection.Open()


I have been go through check with the list below:-

Win+RUN => odbcad32.exe
Data Sources (ODBC) - Installed Windows (x86, 64-bit), MSI Installer
REF: http://dev.mysql.com/downloads/connector/odbc/

Connection Parameters:
HTML
Data Souces Name: myDNS
Description     : [leave it empty]
TCP/IP address  : 127.0.0.1
Name Pipe       : [AutoDisabled]
User            : root
password        : [blank]
Database        : myDatabase
Click button test -> Connection Successful
Click OK


I do the same with [User DNS] and [System DNS].

Click Tab -> Connection Pool
Enable perfMon
Click Apply

Connection string value - >
CSS
Driver={MySQL ODBC 5.3 ANSI Driver};SERVER=localhost;DNS=myDNS;Database=myDatabase;UID=root;OPTION=3


The value is there, but when it come to open the database, it hit the error of the subject title. LOCALHOST was running well, as i using HeidiSQL 8.3.0.4694 it allow me to connected the local database using UID: root and pwd: [blank].

Information Hosting & debugging
HTML
hosting      : wampServer 2.1 x32[Online]
Database     : mySQL [Heidi 8.3]
Visual studio: debugging mode hit the error.
OS           : windows 7 


Anything i can furthermore to check with? Please help out =(
Posted
Updated 3-Sep-14 17:43pm
v5
Comments
George Jonsson 4-Sep-14 0:29am    
Have you compiled your code as 32 bit or 64 bit?
Looks like you have installed the 32 bit driver, so you need to match your project settings.
Wei Kean 4-Sep-14 2:26am    
No, it is 64-bit, while you can see the link refer:
Windows (x86, 64-bit), MSI Installer 5.3.4 7.2M
Download
(mysql-connector-odbc-5.3.4-winx64.msi)

By the way, where do i set the project settings?
George Jonsson 4-Sep-14 21:56pm    
Sorry, your reply didn't show up in my inbox.
Right-click on the project in the solution explorer, and select 'Properties'.
In the properties window that pops up, you select the 'Build' tab.
Check that the 'Platform target' is set to 'x64'.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900