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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Any details of the error message? Just give "jdbc:mysql://localhost/mydb?user=root&password=" a try.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
Any details of the error message? Just give "jdbc:mysql://localhost/mydb?user=root&password=" a try.
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
Your server was probably started with --skip-networking. What happens if you 'telnet localhost 3306'?
Your server was probably started with --skip-networking. What happens if you 'telnet localhost 3306'?