Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Access denied to me in mysql

 
Trelston Moraes
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used the following piece of code to connect to a MySql database.The error message that i get is "Access denied for user 'ROOT'@'TRELSTON' (using password: YES)". Please check the code and see if it is perfect or i have made a mistake somewhere or this error is because i have no access to the database. My PM thinks i have made a mistake.
Please help.


<%

String dbUrl ="jdbc:mysql://dest:3306/ai?user=ROOT&password=root";
String dbClass = "com.mysql.jdbc.Driver";
//String query = "Select * FROM users";
Connection con = null;
try {

Class.forName(dbClass).newInstance();
//con = DriverManager.getConnection("jdbc:mysql://destscience:3306/Sakai","ROOT","sa");
con = DriverManager.getConnection(dbUrl);
//Statement stmt = con.createStatement();
out.print("Connection Created");
con.close();
}
catch(Exception e)
{
out.print(e.getMessage());
}
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trelston,
Welcome to JavaRanch!

Can you connect to mysql from the command line with that username/password? This will help narrow down where the problem lies.
 
Trelston Moraes
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
Trelston,
Welcome to JavaRanch!

Can you connect to mysql from the command line with that username/password? This will help narrow down where the problem lies.


Thanks Jeanne
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic