File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't get access to mysql database

 
Alan Shiers
Ranch Hand
Posts: 237
  • 0
  • 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"
pattern="common"/>


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

</Context>

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:
2186)
... 45 more

Please advise,

Alan
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check that the password is correct..
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic