回 帖 发 新 帖 刷新版面

主题:jsp+sql 2000连接测试问题

    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
    org.apache.jsp.qsql_005ftest_jsp._jspService(qsql_005ftest_jsp.java:107)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
    com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
    com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
    com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
    com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
    com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    java.sql.DriverManager.getConnection(DriverManager.java:525)
    java.sql.DriverManager.getConnection(DriverManager.java:171)
    org.apache.jsp.qsql_005ftest_jsp._jspService(qsql_005ftest_jsp.java:53)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

           这个问题都好几天了
           麻烦高手给解决一下
           谢谢了

回复列表 (共6个回复)

沙发

驱动的三个包放到COMMON/LIB下了吗

板凳

谢了
     问题解决
         新问题
   org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 10 in the jsp file: /lyr/edit2.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\lyr\edit2_jsp.java:81: unclosed string literal
String sql="update custom set 
           ^


An error occurred at line: 10 in the jsp file: /lyr/edit2.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\lyr\edit2_jsp.java:82: unclosed character literal
pwd='"+pwd+"',nickname='"+nickname+"',name='"+name+"',gender='"+gender+"',career='"+career+"',address='"+address+"',email='"+email+"',tel='"+tel+"',birth='"+birth+"' where uid='"+uid+"'";
    ^
2 errors

3 楼


只谢不给分呀[em2]

你的新问题希望你能贴的再完整点

还有我估计很可能是代码问题 而 不是配置问题了[em2]

4 楼

好像你的后一个引号忘记写了。

5 楼

HTTP Status 500 - 

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

type Exception report

message 

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

exception 

javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver][SQL Server]用户 '(null)' 登录失败。原因: 未与信任 SQL Server 连接相关联。
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
    org.apache.jsp.lyr.logon_jsp._jspService(logon_jsp.java:118)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]用户 '(null)' 登录失败。原因: 未与信任 SQL Server 连接相关联。
    sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
    sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
    sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
    sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
    sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    java.sql.DriverManager.getConnection(DriverManager.java:512)
    java.sql.DriverManager.getConnection(DriverManager.java:193)
    org.apache.jsp.lyr.logon_jsp._jspService(logon_jsp.java:62)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


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


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

Apache Tomcat/5.0.28
  问题:
  <SCRIPT language="javascript">
functiom backward()
{
history.back();
}
</SCRIPT>
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文挡</title>
</head>
<body>
<p>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String driver = "jdbc:odbc:try";
Connection conn = DriverManager.getConnection(driver);
Statement stmt = conn.createStatement();
boolean a;
String select;
String uid=request.getParameter("uid");
String pwd=request.getParameter("pwd");
String career=request.getParameter("select");
String sql="select * from custom where uid='"+uid+"' and pwd='"+pwd+"' and career like '"+career+"'";
ResultSet rs=stmt.executeQuery(sql);
a=rs.next();
if((a==true)&&(career.compareTo("student")==0))
{
rs.close();
session.setAttribute("uid",uid);
%>
:)欢迎您<%=uid%></p>
<table width="434" border="0">
 <tr>
   <td width="57"><form name="form2" id="form2" method="post" action="logoff.jsp">
     <input type="submit" name="Submit" value="注销" />
   </form></td>
   <td width="118"><form name="form3" id="form3" method="post" action="edit1.jsp">
    <input type="submit" name="Submit22" value="查看/修改个人信息" />
   </form></td>
   <td width="124">&nbsp;</td>
   <td width="117">&nbsp;</td>
 </tr>
</table>
<%}
else if(a==true&&career.compareTo("teacher")==0)
{
%>
<%}
else
{
rs.close();
%>
</p>
<p>&nbsp;</p>
<p>对不起!您的输入有误,请重新填写!</p>
<p><input type="button" name="Button2" value="返回上一步" onclick="backward()"></p>
<%}%>
</body>
</html>
代码

6 楼


打下sql SP3补丁,SQL语句好象也有问题,自己再看看

我来回复

您尚未登录,请登录后再回复。点此登录或注册