I'm trying connect to database from java and get the following error message:
java.sql.SQLException: Access denied for user 'gda'@'localhost' (using password: YES)
but using same credentials from command line I'm connect
server$ mysql -ugda -pgda
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2666453
Server version: 5.5.39-36.0-log Percona Server (GPL), Release 36.0, Revision 697
Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
on another database my java work fine and able connect. seems to be an issue at database level ?! what I need to fix at database level ?
adding the code of the connection:
public Connection getConnection() {
try {
Class.forName(jdbcDriver);
connection = DriverManager.getConnection(connectionString());
}
catch(Exception ex) {
ex.printStackTrace();
logger.error("Exception:" + ex.getMessage());
errorMessage = ex.getMessage();
}
return connection;
}
where:
jdbc:mysql://127.0.0.1:3306/db?user=gda&password=gda