MySQL 5.0.15-nt - Requested database driver was not found

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
krisleech
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 08.09.2006, 17:14

MySQL 5.0.15-nt - Requested database driver was not found

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
josimarz
Junior Boarder
Junior Boarder
Posts: 41
Joined: 14.09.2009, 17:29
Location: Brazil

Post 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
Post Reply