0

I am developing java swing application but I can't share to local network.

I'm making Grant privileges to the database that was setup on my chosen PC-server: example, grant all privileges on db_name.* to 'username'@'localhost' identified by 'password'; and I'm setting my connection string : jdbc:mysql://192.168.2.3:3306/mydatabase name

but It said: is not allowed to connect to this mariadb from other pc

this is my connection code Connection conn = null;

public static Connection ConnectDB() {
    try {
        Class.forName("com.mysql.jdbc.Driver");
     
        Connection conn = DriverManager.getConnection("jdbc:mysql://192.168.112.159:3306/dbhr", "root", "root");
        return conn;
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, e);
        return null;
    }
}
Shadow
  • 33,525
  • 10
  • 51
  • 64
me robi
  • 27
  • 5

0 Answers0