• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

can't get access to mysql database

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 178
2
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check that the password is correct..
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic