0
我下面在這裏http://thecafetechno.com/tutorials/spring/spring-ormlite-example-integration-eclipse/的ORMLite JDBC例子來學習如何使用ORMLite連接到MySQL在Java中,但是當我運行的IntelliJ程序ORMLite JDBC錯誤,我得到了以下錯誤:與連接MySQL的
com.intellij.rt.execution.application.AppMain main.CellPhoneDemo
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:315)
at com.j256.ormlite.jdbc.JdbcConnectionSource.initialize(JdbcConnectionSource.java:135)
at com.j256.ormlite.jdbc.JdbcConnectionSource.<init>(JdbcConnectionSource.java:114)
at com.j256.ormlite.jdbc.JdbcConnectionSource.<init>(JdbcConnectionSource.java:56)
at main.CellPhoneDemo.main(CellPhoneDemo.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
我相信MySQL服務器正在我的Mac上運行,因爲我使用單獨的工具「phpmyadmin」來訪問數據庫。我使用從Maven導入的Java(版本5.1.29)的MySQL連接器。所以我很困惑什麼可能會出錯?謝謝