Delphi mysql ado connectivity

I am trying to connect to an ADO connection in Delphi XE3 and am having a lot of difficulties.

I have an ODBC driver installed on my machine (Win7 x64), the driver displays as โ€œmySQL ODBC 5.1 driverโ€ in ODBC data sources. Mysql version 5.5.

I understand that I will need to add the TadoConnection component to the form and then assign it the corresponding connection string, as shown below:

var conn: TADOConnection; procedure TForm1.Button1Click(Sender: TObject); begin conn := conn.Create(nil); conn.ConnectionString := 'DRIVER={MySQL ODBC 5.1 Driver}; SERVER=myserver; PORT=3306; DATABASE=mysql; UID=myuser; PASSWORD=mypassword;OPTION=3;'; conn.Connected := true; end; 

When I launch the application and click the button, I get an error message

Project Project1.exe raised an EOleException class with the message "[Microsoft] [ODBC Driver Manager] No data source name was found and the specified driver was not specified by default.

Can anyone help me? What did I miss? I tried to search for examples on the Internet and still have not experienced joy. Any advice is greatly appreciated ...

+4
source share
1 answer

You just need to check your ODBC drivers ... Go to the control panel .. Administrative Tools ... and check which version of the ODBC driver you have ... Then use the correct one ... For example, I use the latest version of MySQL ODBC. Driver = {MySQL ODBC 5.2 ANSI Driver}

+1
source

All Articles