Connect Java system to database on server

Asked

Viewed 324 times

0

I have a Desk system in which I am trying to connect to a database that is on the server. But every time I try to connect the following error:

java.sql.Sqlexception: null, message from server: "Host 'nco-inf-04.cop.com.br' is not allowed to connect to this Mysql server"

How I release permission to all users who will have the system installed?

Connection class:

public class Conexao {

    private static final String USUARIO = "root";
    private static final String SENHA = "";
    private static final String URL = "jdbc:mysql://10.70.111.24:3306/db_prestadores";
    private static final String DRIVER = "com.mysql.jdbc.Driver";

    // Conectar ao banco
    public static Connection abrir() throws Exception {
        // Registrar o driver
        Class.forName(DRIVER);
        // Capturar a conexão
        Connection conn = DriverManager.getConnection(URL, USUARIO, SENHA);
        // Retorna a conexao aberta
        return conn;

    }

}

Workbench:

inserir a descrição da imagem aqui

  • 1

    Having this database located on a server, it has already happened to me once, some firewall or connection rule does not allow my entry. Take a look at your rules.

1 answer

1


I solved the problem by creating a new user: inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.