我想使用JDBC我将mysql驱动程序添加到classpath中,如下所示:
但即使我得到这个错误:
java.lang.ClassNotFoundException:com.mysql.jdbc.Driver at at java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)at java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:354)at java.lang.ClassLoader.loadClass(ClassLoader.java:425)at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308)at at java.lang.ClassLoader.loadClass(ClassLoader.java:358)at java.lang.Class.forName0(Native Method)at java.lang.Class.forName(Class.java:191)at dao.JdbcTest1.main(JdbcTest1.java:23)
这是我的代码:
public static void main(String[] args) {
String url = "jdbc:mysql://localhost:3306/bd_italiano";
String utilisateur = "root";
String motDePasse = "";
Connection connexion = null;
try{
Class.forName("com.mysql.jdbc.Driver ");
connexion = DriverManager.getConnection( url, utilisateur, motDePasse );
DatabaseMetaData dbMetaData = connexion.getMetaData();
System.out.println("Type de la base de données : " + dbMetaData.getDatabaseProductName());
System.out.println("Veresion de la base de données : " + dbMetaData.getDatabaseMajorVersion());
System.out.println("Nom du driver : " + dbMetaData.getDriverName());
System.out.println("Nom du user de la base de données : " + dbMetaData.getUserName());
} catch(Exception e) {
e.printStackTrace();
} finally {
if(connexion!=null)
try {
connexion.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
请帮助我
答案 0 :(得分:2)
您有一个提取空间,它应该是org.slf4j.impl.StaticLoggerBinder
而不是Class.forName("com.mysql.jdbc.Driver")
答案 1 :(得分:1)
从
中删除尾随空格<select name="ListLocations" class="form-control input-md"
ng-model="Locations"
ng-options="Locations as Locations.location for Locations in data.WotcSummary track by Locations.location">
<option value=""> </option>