I've created an application for our company. At first, I've tried to create without password on my database in MySQL-xampp and it works fine. Now my problem is I put a password on my database and my application is now throwing me this error whenever I log in:
SQL java.sql.SQLException: Access denied for user 'root'@'CITSP-MOB7'(using password: YES)
I also get an error connecting my database:
Unable to connect. Cannot establish a connection to jdbc:mysql//localhost:3306/mydb using com.mysql.jdbc.Driver (Access denied for user 'root'@'CITSP-MOB7' (using password: YES)).
Here is my code for database connection:
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://192.168.1.112:3306/citsp";
static final String USER = "root";
static final String PASS = "mypassword";
try{
Class.forName("com.mysql.jdbc.Driver");
}catch(ClassNotFoundException ex){
}
//STEP 3: Open a connection
System.out.println("Connecting to database...");
conn = DriverManager.getConnection(DB_URL,USER,PASS);
//STEP 4: Execute a query
System.out.println("Creating statement...");
stmt = conn.createStatement();
Can somebody help me to solve my connection problem? Your answer will be appreciated. Thanks in advance! :)