DbExpress drivers for MySQL V5.0
Having developed an application in Delphi for a client that used the Borland DbExpress drivers to access a MySQL V4.0 database, my client upgraded the database to MySQL V5.0. The Borland drivers only support MySQL V4.0, so I looked for a compatible driver, or an Open-Source driver I could update.
I found what I needed on SourceForge — the OpenDbx project provides a driver for MySQL V4.1, released under the LGPL.
I have updated this driver to work with MySQL V5.0. The source code and compiled DLL are available for download:
- dbxopenmysql5_source.zip — Source code, 34,837 bytes, 3rd August 2006
- dbxopenmysql5_dll.zip — Compiled DLL, 97,032 bytes, 3rd August 2006
- dbxopenmysql5_dcu.zip — Compiled DCUs for static linking, 42,928 bytes, 3rd August 2006
Installation instructions
For full instructions see the install.txt file in each .zip.
Copy the DLL somewhere on your path. You will also need an appropriate (V5.0) libmysql.dll on the path.
If you're setting your dbexpress stuff up in the IDE, append the contents of the .ini files to the existing ones of the same name in your Delphi installation.
If you're setting up the dbexpress stuff programmatically, then you need something like:
var Connection: TSQLConnection;
begin Connection := TSQLConnection.Create(nil);
Connection.DriverName := 'dbxmysql';
Connection.GetDriverFunc := 'getSQLDriverMYSQL50';
Connection.LibraryName := 'dbxopenmysql50.dll';
Connection.VendorLib := 'libmysql.dll';
Connection.Params.Append('Database=NAME_OF_DATABASE);
Connection.Params.Append('User_Name=NAME_OF_USER');
Connection.Params.Append('Password=PASSWORD');
Connection.Params.Append('HostName=localhost');
Connection.Open; // ... do stuff
Connection.Free;
end;
한글 문제 해결을 위해서
Connection.Params.Append('ServerCharSet=EUCKR');
추가해 줄것
원문
http://www.justsoftwaresolutions.co.uk/delphi/dbexpress_and_mysql_5.html