When I run this code:
String url = "jdbc:mysql://localhost:3306/staion_meteo";// phpmyadmin
String user = "root";
String passwd="" ;
Connection conn = DriverManager.getConnection(url, user, passwd);
System.out.println("you are connected to the data base : "+"station_meteo");
I get the following exception:
No suitable driver found for jdbc:mysql://localhost:3306/staion_meteo
首先做...
Class.forName("com.mysql.jdbc.Driver");
Use this
Class.forName("com.mysql.jdbc.Driver").newInstance();
before your connection. Also make sure mysql-connector.jar
in your class path.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.