m374018
2014-10-31 03:19
采纳率: 0%
浏览 3.3k

JSP连接ACCESS数据库出错,tomcat

用的是JdbcOdbc,已配置School系统数据源,尝试了网上好多方法,都没有解决,上火。。
这是tomcat出错信息:
org.apache.jasper.JasperException: An exception occurred processing JSP page /index1.jsp at line 28

25:


26: <%
27: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
28: Connection conn=DriverManager.getConnection("jdbc:odbc:School");
29: Statement stat=conn.createStatement();
30: String sql="insert into T_STUDENT(STUNO,STUNAME,STUSEX) values ('4','老虎','男')";
31: int i=stat.executeUpdate(sql);

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause
javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access 驱动程序] 不能打开数据库 '(未知的)'。应用程序可能无法识别该数据库,或文件可能损坏。
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jsp.index1_jsp._jspService(index1_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause
java.sql.SQLException: [Microsoft][ODBC Microsoft Access 驱动程序] 不能打开数据库 '(未知的)'。应用程序可能无法识别该数据库,或文件可能损坏。
sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
org.apache.jsp.index1_jsp._jspService(index1_jsp.java:86)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

这是JSP源码:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:School");
Statement stat=conn.createStatement();
String sql="insert into T_STUDENT(STUNO,STUNAME,STUSEX) values ('4','老虎','男')";
int i=stat.executeUpdate(sql);
out.println("cheng gong+ "+i+" hang");
stat.close();
conn.close();

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • qq_30651453 2016-05-17 14:20

    不知道啊,怎么办,我也行不到办法

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题