It's been a while since I've used MySQL, but I think "%" is just a wildcard meaning "any host." Cayenne doesn't send the host along . . . MySQL figures that part out when it receives the connection. You need to set up your own DNS appropriately. Check the MySQL logs to see what hostname MySQL thinks is being used.

--
Kevin

On Apr 18, 2008, at 5:15 PM, Ozakca, Muzaffer wrote:

Hi,

I have an issue when I’m trying to connect to a Mysql database on a different machine than the one that runs my code. I get this exception:

java.sql.SQLException: Access denied for user 'user'@'%'

As you might know, Mysql users consist of a name and a location (or % for all locations). For example, you can define [EMAIL PROTECTED] to be a user. The user cannot login if s/he is not on “localhost”.

I’m running my code on machineA and the database is on machineB. The database user is defined as [EMAIL PROTECTED] I can connect to the database using the normal mysql tools on machineA.

The login credentials are specified as

<login userName="user" password="xxx"/>

In the cayenne config file. My question is how can I tell cayenne to use a specific machine name (i.e. machine’s DNS name) instead of “%”

I hope I am clear.

Thanks,
Muzaffer


Reply via email to