Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate » MS SQL  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui]
ekinfeng





发贴: 12
积分: 0
于 2005-04-14 00:14 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我也出现了同样的问题
WINDOWs2003+J2SDK1.4.2_07+SQL2000
其中sqlsever2000 sqlserver sp3的补丁以打上
我的三个环境变量在classpath中如下设置
D:\Apache\Tomcat\common\lib\msbase.jar;
D:\Apache\Tomcat\common\lib\mssqlserver.jar;
D:\Apache\Tomcat\common\lib\msutil.jar;
测试的JSP页面文件如下:
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*" %>
<html>
<body>
<%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=BookStore";
//pubs为你的数据库的
String user="test";
String password="test";
Connection conn=DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement();
String sql="select * from guest";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
(注:其中BookStore为自己创建的数据库,guest为创建的表)
在TOMCAT5.0.30中运行后页面中有如下错误信息:
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][SQLServer 2000 Driver for JDBC][SQLServer]用户 'test' 登录失败。原因: 未与信任 SQL Server 连接相关联。
  org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
  org.apache.jsp._1_jsp._jspService(_1_jsp.java:84)
  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][SQLServer]用户 'test' 登录失败。原因: 未与信任 SQL Server 连接相关联。
  com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
  com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
  com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
  com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
  com.microsoft.jdbc.sqlserver.tds.TDSLoginRequest.processReplyToken(Unknown Source)
  com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(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:512)
  java.sql.DriverManager.getConnection(DriverManager.java:171)
  org.apache.jsp._1_jsp._jspService(_1_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)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
本人是刚开始学习JSP,希望有好心的朋友可以给我分析下情况,万分感谢!




JAVA学习日子分享

话题树型展开
人气 标题 作者 字数 发贴时间
16432 jdbc连接sqlserver2000出错信息 huahualiushui 291 2005-04-09 12:02
14415 Re:jdbc连接sqlserver2000出错信息 why 108 2005-04-10 06:16
14496 Re:jdbc连接sqlserver2000出错信息 czl1314 1130 2005-04-10 16:25
14482 Re:jdbc连接sqlserver2000出错信息 czl1314 18 2005-04-10 18:51
14508 Re:jdbc连接sqlserver2000出错信息 why 1315 2005-04-10 21:55
14503 Re:jdbc连接sqlserver2000出错信息 czl1314 127 2005-04-11 15:25
14424 Re:jdbc连接sqlserver2000出错信息 why 400 2005-04-11 19:30
14635 Re:jdbc连接sqlserver2000出错信息 ekinfeng 3801 2005-04-14 00:14
14346 Re:jdbc连接sqlserver2000出错信息 why 590 2005-04-14 00:52
14333 Re:jdbc连接sqlserver2000出错信息 why 325 2005-04-14 01:00
14448 Re:jdbc连接sqlserver2000出错信息 ekinfeng 78 2005-04-14 13:46
14765 Re:jdbc连接sqlserver2000出错信息 why 291 2005-04-14 20:00

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923