Page 1 of 1

MySQL 5.0.15-nt - Requested database driver was not found

Posted: 02.02.2007, 13:12
by krisleech
I have copied the DLL from my MySQL install to System32 and renamed it from libmySQL.dll to libmySQL50.dll, but when I try and make a connection I get an exception with the message "Requested database driver was not found". I have tried both below codes (password removed):

Code: Select all

conn := DriverManager.GetConnection('zdbc:mysql-5.0://localhost:3306/testdb?username=root;password=******');

Code: Select all

conn := DriverManager.GetConnection('zdbc:mysql-5://localhost:3306/testdb?username=root;password=******');
I have also tried the DLL that comes with ZeosLib. Is there a difference?

Any suggestions would be welcome...

Many thanks, K.

Posted: 02.02.2007, 16:22
by mdaems
Well, first try putting the dll next to you exe file. Then you are sure it can be found. Name should be libmysql50 or simply libmysql.
Did you try using the zconnection component already? Did that work?
dbc connections are not that easy to experiment with. So if you can first get something to work with a component you may 'debug' the connect string out of the ZConnection.pas.

Mark

Posted: 20.02.2012, 18:40
by josimarz
hello krisleech,

I know the post is old, but to solve this problem you must register the MySQL driver in DriverManager with this code:

Code: Select all

DriverManager.RegisterDriver(TZMySQLDriver.Create);
Another way is to include the unit ZDbcMySQL USES section. The initialization section of ZDbcMySQL be responsible for registering the driver.

A more generic way is to include the unit ZConnection USES section, which record the drivers for all supported databases.

I hope this helps.

josimarz