Link to home
Start Free TrialLog in
Avatar of jeff1919
jeff1919

asked on

ava.sql.SQLException: Invalid authorization specification

I am running a testing java program and get the following error message. I have no problem login to mysql with the same username and password. I have tried to connect to the 'test' database without username and password and got no error.
(That means the jdbc driver is working fine.) i have tried to grant all privileges to the user and still got the same error messages. Please help.

===================================================================
java.sql.SQLException: Invalid authorization specification,  message from server: "Access denied for user: 'epuser@interfacezone.net' (Using password: YES)"
================================================================
import java.sql.*;

public class TestMysql
{
  public static void main(String args[]) {
    try {
      /* Test loading driver */

      String driver = "com.mysql.jdbc.Driver";

      System.out.println( "\n=> loading driver:" );
      Class.forName( driver ).newInstance();
      System.out.println( "OK" );

      /* Test the connection */

      String url = "jdbc:mysql://localhost:3306/test";
        String username = "epuser";
      String password = "eppass";
      System.out.println( "\n=> connecting:" );
      DriverManager.getConnection( url, username, password );
      System.out.println( "OK" );
    }
    catch( Exception x ) {
      System.err.println( x );
    }
  }
}
ASKER CERTIFIED SOLUTION
Avatar of Umesh
Umesh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial