Access Denied

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ewong
Posts: 21
Joined: Thu 20 Jan 2011 01:22

Access Denied

Post by ewong » Wed 29 Jun 2011 03:07

Hi,

I have a MySQL database on a local network server and
am having trouble connection via TMySQLConnection.

mycon := TMySQLConnection.create(nil);
mycon.database := 'mydb';
mycon.server := '192.168.7.18';
mycon.user := 'myuser';
mycon.password := 'mypass';
mycon.connect;

It gives me a EMySQLException (btw, which module is this from?)
saying "#42000Access denied for 'myuser'@'%' to database 'mydb'.

Using dbforge, I create a new connection using the following parameters:

Server : 192.168.7.18
User : myuser
Password : mypass
Database : mydb

And it connects ok.

Am I missing something?

Thanks

Ed

ewong
Posts: 21
Joined: Thu 20 Jan 2011 01:22

Post by ewong » Wed 29 Jun 2011 03:36

*sigh*

I found out why.

The database name is case sensitive. :(

Sorry for the message churn.

But, with regards to catching errors, where do I find the
documentation of EMySQLException? The following gives me
an undefined declaration error.

Edmund

davidmarcus
Posts: 50
Joined: Tue 25 Jan 2005 11:22
Location: Somerville, MA
Contact:

Post by davidmarcus » Wed 29 Jun 2011 04:45

EMySqlException is defined in MySqlErrors.pas.

AndreyZ

Post by AndreyZ » Wed 29 Jun 2011 07:42

You should work with the EMyError exception class instead of EMySQLException. Here is an example:

Code: Select all

try
  MyConnection.Open;
except
  on E: EMyError do
    ShowMessage(E.Message);
end;
You can find more information about EMyError in the MyDAC documentation.

Post Reply