0

I am trying to connect to MySQL database using Delphi Xe5 and fire monkey mobile application. I am using an TSQLConnection to connect to the database but i get an error DBX Error: Driver could not be properly initialized. Client library may be missing, not installed properly, of the wrong version, or the driver may be missing from the system path.

I have read the below articles of which none had a solution that worked.

Articles:

DBX Error: Driver could not be properly initialised

http://wiltonsoftware.com/posts/view/getting-embarcadero-dbexpress-mysql-working-dbx-error-driver-not-initialized

None of their solutions seem to work, i use delphi xe5 on Windows 64x. I have tried downloading the zip file libmysql.dll and coppied into the following paths mentioned but to no avail.

C:\Users\Public\Documents\RAD Studio\12.0\Bpl
C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\bin

Can anybody please assist me in understanding why i am not able to connect to my MySQL database?

Community
  • 1
  • 1
Marcel
  • 874
  • 1
  • 14
  • 28
  • MySql works fine for me on XE4 and XE6 (don't have XE5) on Win7-64bit. However, I did a full install of mySql 5.6 from their website, I didn't just d/load the DLL. The full install installs a mySql server service. Maybe you should try the full install if you haven't already. – MartynA Aug 20 '14 at 08:48
  • Btw, your error message is the standard generic one from DBX and just seems to mean "something went wrong somewhere". I'm not suggesting you switch to FireDAC, but you might try connecting to your db using a FireDAC connection, because FireDAC's error messages tend to be a bit more specific and helpful than DBX's and might lead you straight to the problem if it's a configuration one (FD did yesterday for me with IB). – MartynA Aug 20 '14 at 09:10
  • @martynA I am installing mysql now to see if the problem is resolved. If it does not work i will use firedac and see if that helps. Thank you – Marcel Aug 20 '14 at 10:28
  • @martynA The FDConnection connects without a problem. – Marcel Aug 20 '14 at 10:36
  • Good. I've written what I said up as an answer because people come here looking for answers and don't always seem to notice when the solution is in the comments. – MartynA Aug 20 '14 at 11:09

1 Answers1

0

Your error message

DBX Error: Driver could not be properly initialized. Client library may be missing, 
not installed properly, of the wrong version, or the driver may be missing from the 
system path.

is the standard generic one from DBX and just seems to mean "something went wrong somewhere". Error-reporting doesn't seem to be DBX's strong point; a couple of times recently I've had that error when the problem turned out to be quite different than it might lead you to expect. What's annoying about it is that I only found out because I happened to have "Break on exception" turned on in the IDE and could see that the initial exception came with quite different and more revealing info, but the DBX driver seems to re-raise with that text entirely replaced by its generic, info-free version, at least in the circumstances I ran into.

AS you've subsequently found out, a FireDAC connection may succeed in connecting where a DBX one fails, and even where it fails, its error messages are more specific than DBX's. It's a shame because I find FD more fidly to set up (like I always forget its SqlWait component and it doesn't tell me that I have until r/time). So, I'm not suggesting anyone should switch to FireDAC if they've already got DBX working on a given database, just that FD can be a useful diagnostic tool.

MartynA
  • 30,454
  • 4
  • 32
  • 73
  • I am having another problem now. My Rad studio crashed right after my post this morning. I un installed and re-installed it's working. But now i am getting an error with the fdconnection aswell.Error:`[FireDAC][Phys][MySQL]-314. Cannot load vendor library[libmysql.dll or libmysqlgld.dll]. The system cannot find the file specified. Hint: check it is in the PATH or application EXE directories, and has 86 bitness` what can cause this? – Marcel Aug 20 '14 at 13:55
  • Well, have you verified that libmysql.dll is on your path, and that it is the 32-bit version, not the 64-bit one? Btw, I've been using Delphi since version one one can't remember the last time I had to re-install it following an IDE crash - usually rebooting the PC is the most that's necessary. More likely, your mySql set-up was damaged by the crash, especially if your PC hasn't been rebooted since you installed it, so the first thing I would have done would be to re-install mySql, not Delphi. – MartynA Aug 20 '14 at 14:07
  • how do i find the path that the application is looking for? – Marcel Aug 20 '14 at 14:14
  • It's the other way around. The system has a defined set of paths, which you get to as follows: Control Panel | System Advanced System settings and in the pop-up, click the Environment Variables button, then look in the System Variables list for the one that says "Path". That's where Windows will look if it doesn't find the the dll in the application's folder (that being where the IDE puts the compiled .Exe, which is not necessarily the same as the project's folder). – MartynA Aug 20 '14 at 14:26