| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6462 人关注过本帖
标题:JDBC连接Access数据库
只看楼主 加入收藏
z13535367342
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-12-12
收藏
 问题点数:0 回复次数:0 
JDBC连接Access数据库
报错信息,哪里出问题
HTTP Status 500 - An exception occurred processing JSP page /Examples_26.jsp at line 32

type Exception report

message An exception occurred processing JSP page /Examples_26.jsp at line 32

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /Examples_26.jsp at line 32

29: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
30: //step4:璁剧疆鏁版嵁搴撹?闂?繛鎺ュ瓧绗︿覆  
31: String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb,*.accdb)};DBQ="+path;
32: Connection con = DriverManager.getConnection(url);
33: Statement st = con.createStatement();  
34: String sql = "select * from userInfo";  
35: ResultSet rs = st.executeQuery(sql);  


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
    org.apache.jsp.Examples_005f26_jsp._jspService(Examples_005f26_jsp.java:139)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
    sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6964)
    sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7121)
    sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3080)
    sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
    sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    java.sql.DriverManager.getConnection(DriverManager.java:571)
    java.sql.DriverManager.getConnection(DriverManager.java:233)
    org.apache.jsp.Examples_005f26_jsp._jspService(Examples_005f26_jsp.java:96)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.30 logs.
Apache Tomcat/7.0.30
2015-12-12 21:30
快速回复:JDBC连接Access数据库
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039948 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved