I have followed all necessary steps while connecting my JAVA program to my database on mysql.
my code snippet is as follows:

```
 final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
 final String DB_URL = "jdbc:mysql://localhost/electionDatabase/";
 final String User ="electionUser";
 final String Password="election";
 Class.forName(JDBC_DRIVER);
 conn = DriverManager.getConnection(DB_URL,"electionUser", Password);

 String sql = "select stateId from stateWiseSeats";

```

But still I am getting an error saying:

```
 Access denied for user 'electionUser'@'localhost' to database 'electionDatabase/'

```

i have rechecked my username and password on mysql commandline and also I granted added all the privileges to the user for the specified database. Still I am getting the error. Why?