我已从https://www.sqlite.org/download.html的SQLite下载页面下载了最新的SQLite版本3.13.0。根据发布历史,此版本日期为18.05.2016
我正在开发一个使用Java连接到SQLite数据库的应用程序。我已经在https://bitbucket.org/xerial/sqlite-jdbc/downloads下载了最新的jar“sqlite-jdbc-3.8.11.2.jar”。这个罐子的日期是03-10-2015
我的DAO课程如下:
import java.sql。*;
公共类AccountDao {
private Connection conn=null;
public AccountDao() throws SQLException {
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
conn = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\sony\\Documents\\rough.db");
}
我收到以下错误:
类型异常报告 消息javax.servlet.ServletException:java.sql.SQLException:找不到合适的jdbc驱动程序:sqlite:C:\ Users \ sony \ Documents \ rough.db description服务器遇到内部错误,导致无法完成此请求。 例外 org.apache.jasper.JasperException:javax.servlet.ServletException:java.sql.SQLException:找不到合适的jdbc驱动程序:sqlite:C:\ Users \ sony \ Documents \ rough.db org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:556) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:462) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 根本原因 javax.servlet.ServletException:java.sql.SQLException:找不到合适的jdbc驱动程序:sqlite:C:\ Users \ sony \ Documents \ rough.db org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:916) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:845) org.apache.jsp.account_jsp._jspService(account_jsp.java:333) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 根本原因 java.sql.SQLException:没有为jdbc找到合适的驱动程序:sqlite:C:\ Users \ sony \ Documents \ rough.db java.sql.DriverManager.getConnection(未知来源) java.sql.DriverManager.getConnection(未知来源) classpackage.AccountDao。(AccountDao.java:19) org.apache.jsp.account_jsp._jspService(account_jsp.java:130) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
我已经添加了jar来构建路径,它反映在Eclipse的Referenced Libraries中。
使用错误的jar会出现上述错误吗?