user5809644 user5809644 - 1 year ago 32
MySQL Question

error when connecting mysql to Java netbeans

I am trying to connect a

connector/j driver
to Netbeans.

I am following below steps to connect,


  1. In services I right click and click new connection.

  2. then I browse and add
    mysql-connector-java-5.1.23-bin.jar
    file .

  3. Then click next.

  4. Then comes a
    JDBC url : jdbc:mysql://localhost:3306/mysql
    is
    showing.

  5. I click the test connection button



Then I get the following error:


Cannot establish a connection
to jdbc:mysql://localhost:3306/mysql using com.mysql.jdbc.
Driver (Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago.
The driver has not received any packets from the server.)

Answer Source

I've personally had this problem too. Netbeans sometimes has problems dealing with MySQL. I would suggest you download MySQL Community Server and MySQL Workbench and use those to run your database. It's much more efficient and gives you more control over your database.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download