0

我收到以下错误。

  • 我正在使用 MyEclipse Bling 10.1
  • 部署在 Tomcat 上
  • 微软 SQL 2008 R2

当我在 MS SQL 2000 中执行相同操作时,代码可以正常工作。我想找到我做错的地方。

    HTTP Status 500 - 

--------------------------------------------------------------------------------

type Exception report

message 

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 /uservalidation.jsp at line 16

13: 
14: 
15: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
16:             Connection con5=DriverManager.getConnection("jdbc:odbc:web");
17:             PreparedStatement st1=con5.prepareStatement("select * from login where username=? and pass=?");
18:             st1.setString(1,un);
19:             st1.setString(2,ps);


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause 

javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
    org.apache.jsp.uservalidation_jsp._jspService(uservalidation_jsp.java:109)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause 

java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
    sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
    sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
    sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3073)
    sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
    sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    java.sql.DriverManager.getConnection(DriverManager.java:582)
    java.sql.DriverManager.getConnection(DriverManager.java:207)
    org.apache.jsp.uservalidation_jsp._jspService(uservalidation_jsp.java:77)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.13
4

2 回答 2

1

尝试谷歌搜索根本原因通常是个好主意。在这种情况下,“指定的 DSN 包含驱动程序和应用程序之间的体系结构不匹配”,第一个结果为您提供了答案:http: //msdn.microsoft.com/en-us/library/windows/desktop/ms712362%28v= vs.85%29.aspx

于 2012-05-08T17:52:51.243 回答
-1

检查你的jsp语法。它可能不会在 eclipse 中显示任何错误,但手动检查它是否存在任何丢失的括号或 jsp 语法中的任何错误导致此问题

于 2012-05-08T14:24:08.840 回答