im是Java编程的新功能,也是本论坛的新功能。目前,我正在使用Microsoft Access在具有数据库连接的jsp中执行我的项目。即时通讯试图使用ucanaccess驱动程序进行sql连接,这是我收到错误的地方:java.sql.SQLException:找不到适用于jdbc:ucanaccess:// C:/Users/dbaccess/testDB.accdb的驱动程序。
我正在使用eclipse作为项目的IDE。我已经把所有的5个jar文件放到引用库中,正如其中一位用户在stackoverflow中提到的那样。
String dburl = "jdbc:ucanaccess://C:/Users/dbaccess/testDB.accdb"; Connection con=DriverManager.getConnection(dburl,"",""); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("SELECT * FROM studTab"); boolean b=rs.next(); out.println("registration no: "+rs.getString(1)); out.println("<br>name: "+rs.getString(2)); out.println("<table border=5>"); out.println("<th>"+"IT2353"+"</th>"); while(b) { out.println("<tr>"); out.println("<td>"+rs.getString(2)+"</td>"); out.println("</tr>"); b =rs.next(); } out.println("</table>");
错误: 类型异常报告
消息javax.servlet.ServletException:java.sql.SQLException:否 找到适合的驱动程序 jdbc:ucanaccess:// C:/Users/dbaccess/testDB.accdb
说明服务器遇到意外情况, 阻止它满足请求。
org.apache.jasper.JasperException异常: javax.servlet.ServletException:java.sql.SQLException:不适合 找到jdbc:ucanaccess:// C:/Users/dbaccess/testDB.accdb的驱动程序 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:598) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:499) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) javax.servlet.http.HttpServlet.service(HttpServlet.java:742) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
根本原因javax.servlet.ServletException:java.sql.SQLException:否 找到适合的驱动程序 jdbc:ucanaccess:// C:/Users/dbaccess/testDB.accdb org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:909) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:838) org.apache.jsp.studInfo_jsp._jspService(studInfo_jsp.java:165) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:742) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) javax.servlet.http.HttpServlet.service(HttpServlet.java:742) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
根本原因java.sql.SQLException:找不到适合的驱动程序 jdbc:ucanaccess:// C:/Users/dbaccess/testDB.accdb java.sql.DriverManager.getConnection(未知来源) java.sql.DriverManager.getConnection(未知来源) org.apache.jsp.studInfo_jsp._jspService(studInfo_jsp.java:131) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:742) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) javax.servlet.http.HttpServlet.service(HttpServlet.java:742) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)