tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Bainbridge <ja...@jblinux.org>
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:

Issue: 

  "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."

  Resolution: 

  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 
  '[password]'"

  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.
  
  NOTE:
  
  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 "127.0.0.1" as the hostname
  instead.

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

Regards,
-- 
Jason Bainbridge
KDE Web Team - http://kde.org 
webmaster@kde.org 

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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message