• Post Reply Bookmark Topic Watch Topic
  • New Topic

can't get access to mysql database  RSS feed

Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I'm working on a web app involving database connectivity to MySQL. My context.xml file looks like so:

<Context path="/BannerAd2" docBase="BannerAd2" debug="0"
reloadable="true" crossContext="true">

<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="localhost_bannerad_log." suffix=".txt"

<Resource name="jdbc/banneraddb" auth="Container" type="javax.sql.DataSource"
username="webapp" password="secret" driverClassName="com.mysql.jdbc.Driver"
maxActive="10" maxIdle="3" maxWait="10000"/>


I've used the following GRANT commands to allow access to the database:

grant select,insert,update,delete on banneraddb.* to 'webapp'@'%' identified by 'secret';
flush privileges;

I had no problem executing these two commands. According to documentation for MySQL the "%" symbol is supposed to allow access from any location. Of course the database is on my localhost workstation, so why do I still get the following error message at the command prompt?

Caused by: java.sql.SQLException: Access denied for user 'webapp'@'localhost' (u
sing password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:934)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4104)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1299)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2338)
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:
... 45 more

Please advise,

Ranch Hand
Posts: 178
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check that the password is correct..
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!