I'm trying to connect to a MySQL DB inside an Android Studio project and i keep getting an error that im denied access, i tried a normal Java program and it was fine but with Android it won't.
This is the error:
java.sql.SQLException: Access denied for user 'root'@'Hadi.mynet' (using password: YES)
And this the code for connecting:
new Thread(new Runnable() {
@Override
public void run() {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://192.168.1.108/menu","root","root");
} catch (SQLException | ClassNotFoundException throwables) {
throwables.printStackTrace();
}
}
}).start();
Thanks in advance.