2
votes

I have installed a local server Xampp, which is running mySQL database in Windows. I created a Database on it with one table. The thing is I cannot get a connection to the database when I use the dbExpress TSQLConnection component. When I set the properties as follows:

ConnectionName = MYSQLConnection
Driver = MySQL
Database = databaseName
HostName = localhost
password =
UserName = root

When I change the connected property to true, I get the following error:

Borland.Data.TDBXError: 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 tried making a connection to the database using the Data Explorer, but I still get the above error. I do not know what I'm missing or doing wrong.

Im using Delphi-XE2. with mySQL on the server: MySQL client version: mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $.

I have also tried using an ADO connection, but I do not know how to set the connection string.

I'm still a noob and just want to learn how to make a connection to a mySQL database running on a web server. I cannot afford to buy any components.

1
This issue is usually related to the location of the libmysql.dll file. check if that file is located in any folder of the PATH enviroment variable. - RRUZ
@RRUZ I did copy the libmysql.dll file from my xammo/mySQL/bin/ into my PATH which is program files/embracedero/9.0/lib. It did not work so I also copied it into program files/embracedero/9.0/bin and windows/system32 and still the problem remains - Japster

1 Answers

4
votes

Try this!

Did some google Fu - and stumpled upon this link : http://wiltonsoftware.com/posts/view/getting-embarcadero-dbexpress-mysql-working-dbx-error-driver-not-initialized

That seems to fit your needs. My previous answer was no help .. hope the new one is better.

Old answer:

Make sure you have Data.DBXMySQL in your uses clause.

OK. I'll try a different approach.

Is it working if you setup the connection in the DataExplorer? If not - then it's not a problem with the uses clause. (and you obviously have tried that - sry . must be tired :-))

Otherwise a unit could be like this.

unit Unit1;
interface
uses  // <-- Uses normally goes right after interface ....  (you probably already have one)
  Data.DBXMySql;
implementation
end.