Page 1 of 1

Access Denied

Posted: Wed 29 Jun 2011 03:07
by ewong
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

Posted: Wed 29 Jun 2011 03:36
by ewong
*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

Posted: Wed 29 Jun 2011 04:45
by davidmarcus
EMySqlException is defined in MySqlErrors.pas.

Posted: Wed 29 Jun 2011 07:42
by AndreyZ
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.