Menu

java.net.ConnectException trying to connect

Help
Anonymous
2002-10-08
2002-12-05
  • Anonymous

    Anonymous - 2002-10-08

    I have installed Apache,Tomcat and mysql server in a linux machine.I can connect to mysqlmonitor from the terminal with "mysql -u root -h localhost mybd" but , when I try to connect via JDBC with

      String driver="org.gjt.mm.mysql.Driver";
      String DBUrl="jdbc:mysql://localhost/mydb?user=root";
      Class.forName(driver).newInstance();
      Con = DriverManager.getConnection(DBUrl);

    is throwed the ConnectException.

     
    • Nicholas J. Koch

      Any details of the error message? Just give "jdbc:mysql://localhost/mydb?user=root&password=" a try.

       
    • Anonymous

      Anonymous - 2002-10-09

      the error message : java.sql.SqlException: Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the macihne/port you are trying to connect to?(java.net.ConnectException).
      But I not understand it ,because I can connect to MySQL monitor with "mysql -u root -P 3306 -h localhost mydb",and it means that the server is running

       
    • Mark Matthews

      Mark Matthews - 2002-12-05

      Your server was probably started with --skip-networking. What happens if you 'telnet localhost 3306'?

       
    • Mark Matthews

      Mark Matthews - 2002-12-05

      Your server was probably started with --skip-networking. What happens if you 'telnet localhost 3306'?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.