dbx4mysql

Working with embedded library

Previous Next

Example:

SQLConnection.DriverName := 'DBXE4MySQL';
  SQLConnection.LibraryName := 'dbx4mysql.dll';
  SQLConnection.VendorLib := 'libmysqld.dll'; // or 'notused.dll'
  SQLConnection.GetDriverFunc := 'getSQLDriverDBXE4Mysql';
  SQLConnection.Params.Clear;
  SQLConnection.Params.Add('Database=mysql');
  SQLConnection.Open;

The functionality of the embedded driver is similar to the standard driver with 2 exceptions:

1. the custom parameters would represent the parameters passed to the embedded server (each line = 1 parameter)

Example:

SQLConnection.Params.Add('Custom string="--datadir=C:/mysql/data","--basedir=C:/mysql"');

Please refer to the MySQL manual for the possible parameters and their meaning. At the minimum the basedir has to be set in order for the library to be able to locate the required files to work.

2. when the library is no longer needed it has to explicitelly be unloaded by calling:

Example:

function UnloadMysqlLibrary: wordbool; external 'dbx4mysql.dll';

Please be aware that once this function has been called it is not possible to use the embedded driver anymore. This function would actually only call "mysql_server_end", after which the embedded library would be unloaded.