• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MySql and Tomcat connect with root, but not other user

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Issue: I can connect to my database using root, but not with any other MySql user. Specifically the issue is occurring when the web application is querying the database. The content which is database driven is empty with any other user.

Environment is Tomcat 6
MySql 5.X
JSF Web Application

I have created a DAO structure. I can ping the database using root, and even with my other user, let's call that user Sam.

So I then changed the username and password in the context.xml and in the server.xml to be Sam and SamsPassword. I can ping the MySql database from Eclipse, but when I deploy to the localhost, and enter the url in a browser, the content is empty. A look at the error log in Tomcat shows access is denied. "com.lavaflow.dao.DAOException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'Sam'@'localhost' (using password: YES))"

I am running into a wall on this . . . cannot construct a decent query result from google, so I'm hoping JavaSaloon gurus can help.

..\Wendy
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Wendy,

welcome to java ranch...

have you try to access database using MySql Query browser with new user name and password.
check using MySql Query browser with Sam and SamsPassword. If you are access to database then you can access from your application.

And also check that user Sam and SamsPassword access privileged to the MySql database..
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly, you will need to make sure that the user does have previledge to access the database. If you have not granted access for the user you can see this link on how to do it.

http://dev.mysql.com/doc/refman/5.1/en/adding-users.html
reply
    Bookmark Topic Watch Topic
  • New Topic