tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Bainbridge <>
Subject Re: DB Connection
Date Sun, 25 May 2003 20:59:09 GMT
A straight copy and paste from the README of the MySQL JDBC driver, would seem 
the permissions have changed on the MySQL user you use to connect:


  "When I try to connect to the database with MySQL Connector/J, I get the
  following exception:

  SQLException: Server configuration denies access to data source
  SQLState: 08001
  VendorError: 0

  What's going on? I can connect with the MySQL client."


  MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as 
  Java does not support Unix Domain Sockets. Therefore, when MySQL Connector/J
  connects to MySQL, the security manager in MySQL server will use the
  HOSTS table to determine whether or not the connection should be allowed.

  You must add grants to allow this to happen. The following is an example
  of how to do this (but not the most secure).

  From the mysql command-line client, issue the following command

  "GRANT ALL PRIVILEGES ON [dbname].* to '[user]'@'[hostname]' identified by 

  replacing [dbname] with the name of your database, [user] with the username,
  [hostname] with the host that MySQL Connector/J will be connecting from, and 
  [password] with the password you want to use. Be aware that RedHat linux is 
  broken with respect to the hostname portion for the case when you are 
  connecting from localhost. You need to use "localhost.localdomain" for the 
  [hostname] value in this case.

  Follow this by issuing the "FLUSH PRIVILEGES" command.
  Testing your connectivity with the "mysql" command-line client will not
  work unless you add the "--host" flag, and use something other than 
  "localhost" for the host. The "mysql" command-line client will use Unix
  domain sockets if you use the special hostname "localhost". If you are
  testing connectivity to "localhost", use "" as the hostname

  I suggest you read the permissions/security section of your MySQL server 
  manual for a much more detailed explanation of how this works.

Jason Bainbridge
KDE Web Team - 

On Mon, 26 May 2003 04:06, Jan Behrens wrote:
> hi list,
> i am not sure whether this is a tomcat related problem or something else...
> i am developing a webapp that simulates a banking system (for a school),
> all data is stored in a mysql database (4.0.12). all worked fine for month
> an now, all of a sudden i keep getting the follwoing error when connecting
> to the database:
> java.sql.SQLException: Server configuration denies access to data source
> i then can no longer connect to the db. i do not use tomcats connection
> pooling but instead connect via a special class.
> any help on this would be very much appreciated!
> jan
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message