鍏充簬鏁版嵁搴撹繛鎺ョ殑閿欒锛屾垜寮勪簡濂戒箙閮芥病鏈夊姙娉曡В鍐炽€傝В鍐充簡50鍒嗐€備笉澶熷啀鍔狅紝鍦ㄧ嚎绛夊緟銆傘€傘€?/a>

时间:2021-11-04 20:12:05
title.jsp浠g爜锛?
<%@ page contentType="text/html; charset=gb2312" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><LINK href="hellking.css" type=text/css rel=stylesheet>

<body>
 <%
   boolean isLog=false;
  // out.println(session.getAttribute("isLog"));
  try
  {
   isLog=((String)session.getAttribute("isLog")).equals("1");
  }
  catch(Exception e)
  {
    //out.println(e);
  }
%>
<table width="842" align=center cellpadding=3 cellspacing=1 class=tableborder1>
    <tr>
    <td width="832" class=tablebody2>锛氾細
    <a href="index.jsp" target="_top">棣栭〉</a>
    <a href="index.jsp" target="_top">閭欢</a>
    <a href="shop/searchForm.html" target="mainFrame">鍟嗗搧鎼滅储</a>
    <a href="/jspdev/servlet/forumservlet?jumpPage=1" target="mainFrame">璁哄潧</a>
    <% 
      if(isLog)
       {
         if(((Integer)session.getAttribute("userType")).equals(new Integer(1)))
         {
         %>
         <a href="index.jsp"  target="_top">涓汉淇℃伅</a>
         <%}
         else
         {
         %>
         <a href="manage/index.jsp" target="_new">绯荤粺绠$悊</a>
         <%
         }
        %> 
      <a href="logout.jsp"  target="_top">娉ㄩ攢</a><%}%>锛氾細
    </td> </tr> <tr>
    <td width="832" class=tablebody2> 
    <%
   // out.println(isLog);
   if(isLog)
  {
   %>
    娆㈣繋鍏変复锛?lt;%=session.getAttribute("name")%>,鎮ㄦ槸绗?lt;%=session.getAttribute

("userLogCount")%>娆$櫥褰曪紝鎮ㄤ笂娆$櫥褰曠殑鏃堕棿鏄細<%=session.getAttribute("userLastLogTime")%>
    <%
    }//if
    else
    {
    %>
    
      <form name="form1" method="post" action="login.jsp">
        &nbsp;&nbsp;&nbsp; 鐢ㄦ埛鍚?nbsp;
        <input type="text" name="userId" size="15" style="BORDER-RIGHT: #ffffff 1px groove; 

BORDER-TOP: #ffffff 1px groove; FONT: 12px Verdana,Geneva,sans-serif; BORDER-LEFT: #ffffff 

1px groove; WIDTH: 100px; COLOR: #000000; BORDER-BOTTOM: #ffffff 1px groove; HEIGHT: 18px; 

BACKGROUND-COLOR: #DFF1F9">
         瀵嗙爜 
        <input type="password" name="password" size="15" style="BORDER-RIGHT: #ffffff 1px 

groove; BORDER-TOP: #ffffff 1px groove; FONT: 12px Verdana,Geneva,sans-serif; BORDER-LEFT: 

#ffffff 1px groove; WIDTH: 100px; COLOR: #000000; BORDER-BOTTOM: #ffffff 1px groove; HEIGHT: 

18px; BACKGROUND-COLOR: #DFF1F9">
        <input type="submit" name="Submit" value="纭畾" style="height:20; font:9pt; BORDER-

BOTTOM: #cccccc 1px groove; BORDER-RIGHT: #cccccc 1px groove; BACKGROUND-COLOR: #eeeeee">
  </form> 
  <%
   }//else
   %>   
    </td>
  </tr>
  </table>
</body>
</html>

login.jsp浠g爜濡備笅锛?
<%@ include file="include.inc"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
//鑾峰緱璇锋眰鐨勫弬鏁般€?
String id=request.getParameter("userId");
String psw=request.getParameter("password");
//杩炴帴鏁版嵁搴?
Class.forName(CLASSFORNAME);
Connection con = DriverManager.getConnection(SERVANDDB,USER,PWD);
Statement statement=con.createStatement();
String isCorrect="select * from user_info where userId='" + id + "' and password='" + psw + 

"'";
ResultSet result=statement.executeQuery(isCorrect);
 session.setAttribute("isLog",new String("0"));

if(!result.next())
{
response.sendRedirect("index.jsp");//璐﹀彿鎴栧瘑鐮侀敊璇紝杞叆閿欒椤甸潰
result.close();
statement.close();
con.close();
}
 //濡傛灉鏌ヨ鍚庢湁璁板綍锛岃鏄庣櫥褰曢獙璇佹垚鍔熴€?
else
{
      //淇濆瓨鐧诲綍淇℃伅鍒皊ession瀵硅薄涓€?
  session.setAttribute("name",result.getString("name"));
  session.setAttribute("id",result.getString("userId"));  
  session.setAttribute("email",result.getString("email"));
  session.setAttribute("fav",result.getString("fanvcategory"));
  session.setAttribute("userType",new Integer(result.getInt("userType")));   
  System.out.println(session.getAttribute("userType")); 
  session.setAttribute("isLog",new String("1"));
  int count=result.getInt("userLogCount");
  session.setAttribute("userLogCount",new Integer(count));
  count++;
  session.setAttribute("userLastLogTime",result.getString("userLastLogTime"));  
  java.util.Date time1=new java.util.Date();//鑾峰緱绯荤粺褰撳墠鏃堕棿
      String sqltime=new Timestamp(time1.getTime()).toString();//灏嗗綋鍓嶆椂闂磋浆鎹㈡垚sql server

鍙互璇嗗埆鐨勫璞?nbsp;     
 //鏇存柊鐧诲綍淇℃伅銆?
  statement.execute("update user_info set 

userLogCount="+count+",userLastLogTime='"+sqltime+"' where userId='" + id +"'");
   //鍏抽棴鏁版嵁搴撹繛鎺ョ浉鍏崇殑璧勬簮銆?
  statement.close();
  con.close(); 
  //鎶婇〉闈㈡淳鍙戝埌鐩殑
  response.sendRedirect("index.jsp");
}
%>

include.inc濡備笅锛?
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="com.microsoft.jdbc.sqlserver.SQLServerDriver"%>
<%@ page import="java.lang.*"%>
<%@ page contentType="text/html; charset=gb2312" %>

<% 
   request.setCharacterEncoding("gb2312");
   String CLASSFORNAME="com.microsoft.jdbc.sqlserver.SQLServerDriver";
   String SERVANDDB="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=jspdev";
   String USER="";
   String PWD="";   
%>

褰撳湪杈撳叆http://127.0.0.1:8080/jspdev/login.jsp鍚庛€傚湪椤甸潰涓緭鍏ョ敤鎴峰悕锛歨ellking  瀵嗙爜锛?

hellking鍚庢彁浜ゅ嚭鐜板涓嬮敊璇細

46 涓В鍐虫柟妗?/h2>

#1


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]Error 

establishing socket.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException

(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException

(PageContextImpl.java:758)
org.apache.jsp.login_jsp._jspService(login_jsp.java:125)
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)
com.jspdev.ch8.EncodingFilter.doFilter(EncodingFilter.java:36)


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:512)
java.sql.DriverManager.getConnection(DriverManager.java:171)
org.apache.jsp.login_jsp._jspService(login_jsp.java:81)
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)
com.jspdev.ch8.EncodingFilter.doFilter(EncodingFilter.java:36)


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


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

Apache Tomcat/5.0.28

#2


寤虹珛濂楁帴瀛楅敊,濂借薄鏄綉缁滈敊璇?

#3


鏁版嵁搴撻┍鍔ㄧ▼搴忔湁闂銆傛病鏈夋垚鍔熷缓绔嬫暟鎹簱杩炴帴銆?

#4


閭h浠€涔堝仛鍟婏紝鎴戞槸鎶奙icrosoft SQL Server 2000 Driver for JDBC瑁呭湪C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC涓嬬殑锛岃兘涓嶈兘缁欎釜鍏蜂綋鐨勮娉曞悧锛?

#5


杩樺ソ浜嗭紝鎴戠幇鍦ㄨ繕閮戒笉鐭ラ亾浠€涔堟槸杩炴帴姹?

#6


鏁版嵁搴搖rl鐨勭鍙e彿1433鏄惁姝g‘鍛紵鎶?27.0.0.1鎹㈡垚localhost鎴栬€呬綘鏈哄櫒鐨処P璇曚竴涓嬨€?

#7


鏁版嵁搴撻┍鍔ㄧ殑3JAR鏂囦欢鍔犺浇浜嗘病锛?
灏戜竴涓笉琛?

#8


鎴戞妸杩檓ssqlserver 锛?nbsp;msbase锛?nbsp;msutil杩欎笁涓枃浠堕兘鎸庡埌浜咰:\jakarta-tomcat-5.0.28\jakarta-tomcat-5.0.28\common\lib鐩笅浜嗐€?

#9


楂樻墜甯府灏忓紵鍚э紝鎴戠幇鍦ㄥ緢鎬ュ晩锛?
鎴戝疄鎵炬槸鎵句笉鍒颁粈涔堝師鍥犱簡锛屼笉鐭ラ亾閿欏湪鍝?nbsp;閲屼簡锛孧icrosoft SQL Server 2000 Driver for JDBC鎴戜篃瑁呬簡锛屼笁涓枃浠舵垜涔熸寧鍒颁簡C:\jakarta-tomcat-5.0.28\jakarta-tomcat-5.0.28\common\lib鐩笅浜嗐€傚氨鏄竴鐩磋繍琛屼笉琛屽晩锛侊紒

#10


hao濂藉儚鏄病鏈夊0鏄庨┍鍔ㄥ憖锛屼笉鐭ヤ綘鐢ㄧ殑鏄痵qlserver杩樻槸浠€涔?

#11


鎴戠敤鐨勬槸sqlserver2000 杩欎釜瑕佷笉瑕佽缃甇DBC鏁版嵁婧愬憿锛?

#12


鎶婅繖mssqlserver 锛?nbsp;msbase锛?nbsp;msutil杩欎笁涓枃浠舵斁鍒皐ebapp涓嬬殑WEB-INF/LIB涓嬭竟璇曡瘯锛?

#13


鏁版嵁搴撻┍鍔ㄧ殑闂鍛€锛?

#14


Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();


浣犲ソ鍍忓皯鍐欎簡涓滆タ鍟婏紒锛侊紒锛?

#15


浣犲皯鍐欎簡.newInstance()

#16


鏈夊晩锛屾垜鎶婅繖浜涘叏鏀惧湪include.inc閲岄潰浜?

鍒板簳閿欏湪閭i噷锛?

#17


copy杩涘幓鍚庯紝閲嶅惎杩囦簡涔堬紵

#18


閮借瘯杩囦簡锛屽ぇ瀹惰鐨勬垜閮借瘯杩囦簡锛屽氨鏄笉鐭ラ亾浠€涔堝姙鍟?

浼氫笉浼氳窡鏁版嵁搴撴斁鐨勪綅缃湁鍏崇郴鍟?

#19


鏁版嵁搴撶殑鐢ㄦ埛鍚嶏紝瀵嗙爜閮戒负绌轰箞锛?

#20


鏄晩锛屾垜鍦ㄦ寜瑁匰QLserver2000鏃跺氨娌℃湁璁剧敤鎴峰悕鍜屽瘑鐮佹墍浠ユ垜璁や负搴旀槸绌虹殑鍚э紒

#21


浼氱殑甯垜涓€涓嬪惂锛?

瑙e喅绔嬭鍏冲笎

#22


楂樻墜鍟婏紝璺眰鍟?

#23


浣犵殑杩炴帴鏁版嵁搴撶殑鐢ㄦ埛鍚嶄负绌猴紝杩欐槸涓嶈鐨勶紝鑰屼笖SQL銆€SERVER涔熶笉鏀寔绌虹敤鎴峰悕鐨勩€傜敤JDBC杩炴帴SQL銆€SERVER鐨勬椂鍊欏ソ璞$敤鎴峰悕鍜屽瘑鐮佷笉鑳戒负绌虹殑锛岀敤ODBC鐨勬椂鍊橲QL銆€SEVER灏变笉鑳芥湁绌哄瘑鐮佺殑锛屽惁鍒欒繛涓嶄笂鐨勩€備綘鍏堝啓涓€涓繛鎺ユ暟鎹簱鐨勬祴璇曠▼搴忚瘯璇曞彲椐e彲浠ョ敤绌虹殑瀵嗙爜鐨勩€傜湅鐢ㄦ埛鍚嶅拰瀵嗙爜鍙笉鍙负绌恒€?

#24


浣犲湪鎸夎SQLserver2000鏃跺氨娌℃湁璁剧敤鎴峰悕鍜屽瘑鐮侊紝骞朵笉鑳借涓哄簲鏄┖鐨勶紝SQL銆€SERVER鐨勯粯璁ょ敤鎴峰悕鏄痵a,骞朵笉鏄病鏈夌敤鎴峰悕锛屾墍浠ヤ綘鐨勭▼搴忎腑鐨刄SER鐨勫€艰鏄痵a,鍙槸浣犳病鏈夊瘑鐮侊紝瀹冪殑鍊兼墠涓虹┖銆?

#25


鏈€鍚庢槸鍦⊿QL銆€SERVER涓暟鎹簱鐨勫睘鎬т腑涓簊a鐢ㄦ埛璁剧疆涓€涓瘑鐮侊紝瑕佸畨鍏ㄤ竴浜涖€?

#26


drugon(personal锛夛細鎴戠幇宸叉妸鐢ㄦ埛鍚嶈涓簎ser鍜屽瘑鐮佷负user鍙槸杩欐牱杩樻槸涓嶈鍟婏紒

#27


浣犵湅涓€涓嬫垜鍐欑殑SQLSERVER2000鐨勮繛鎺ワ紝濡傛灉鏄繛鎺ョ殑闂锛屼綘鍏堟妸杩炴帴鍐欏埌BEAN鎴栨槸鐩存帴鍐欏埌JSP椤甸潰閲屽幓璇曚竴璇曪紝鎶婁綘鐨勮繛鎺ラ儴鍒嗘崲鎴愭垜鐨勫氨鑲畾娌℃湁闂浜嗭紙鎴戞槸鍐欏湪BEAN閲岄潰鐨勶級
public Connection connect() throws Exception {
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver")
.newInstance();
System.out.println("jdbc loading....");
String url = "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=cctest";
String user = "sa";
String password = "manager";
con = DriverManager.getConnection(url, user, password);
return con;
} catch (Exception e) {
error = "EXC:Connection to database was lost";
throw new Exception(error);
}
}


#28


杩欐牱鍐欑殑璺熼偅鏍锋湁鍏风殑鐨勫尯鍒悧锛?

#29


鎴戝師浠ヤ负鏄粈涔堥敊浜嗭紝鎴戝氨鍐嶅彟鍐欎竴涓紝鏁版嵁搴撹繛鎺ワ紝鍙槸涔熶竴鏍峰嚭鐜颁笂闈㈢殑閭f牱鍑洪敊鐨勬彁绀猴紵锛?

#30


涓嬭浇SQL Server 2000 Driver for JDBC Service Pack 3
http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en


涓嬩簡瑁呬笂鐪嬬湅

#31


妫€鏌ラ槻鐏锛宨p鍦板潃锛屽鏋滈兘娌¢棶棰橀偅灏辨槸鎿嶄綔绯荤粺鐨勪簨鍎夸簡
濡傛灉鏄痻p(sp1)浠ヤ笂鐨勭増鏈紝Service Pack 3琛ヤ竵瑁呬笂锛岃涓婁簡鍙兘浼氬ソ浣匡紝win2000浠ヤ笂鐨勬搷浣滅郴缁熻浜唖ql2000涓€鑸兘浼氬嚭鐜拌繖绉嶉棶棰橈紝褰撳垵杩欎釜闂鎶樼(浜嗘垜涓ゅぉ涓ゅ锛堟睏锛夛紒寤鸿浣犳渶濂借xp(sp1鐗?鐨勶紝杩欐槸缁堟瀬瑙e喅鍔炴硶锛侊紒锛佸墠鎻愭槸浣犺瀹宻p3琛ヤ竵鍚庝粛鐒惰繛鎺ヤ笉涓?

#32


鎴戠敤鐨勬槸XP(SP2)锛屽ソ鐨勶紝鎴戣瘯涓嬬湅琛屼笉琛岋紵

#33


鍚勪綅澶у摜鎴戣瘯浜嗚繕鏄笉琛岋紵

#34


浼拌鏄綘鐨勬暟鎹簱椹卞姩娌″紕濂?

#35


搴旇涓嶆槸椹卞姩鐨勯棶棰?
浣犵殑sa鐢ㄦ埛鐨勫瘑鐮佹槸涓嶆槸manager鍛€?
浣犲厛鐢ㄥ瘑鐮佷负manager鐨勭敤鎴穝a鐢∣DBC杩炵殑璇曡瘯鐪?濡傛灉鍙互閭e氨涓嶆槸椹卞姩鐨勯棶棰?鍙兘鏄叾瀹冪殑鍘熷洜,鎴栬€呬綘鎶妔p2鍖呭嵏鎺夎瘯璇?浠ュ墠濂借薄鐪嬪埌鍒汉涔熷嚭鐜拌繃杩欐牱鐨勯棶棰?

#36


鎴戣瘯杩囦簡杩樻槸涓嶈銆傛垜鏄敤鎴戠郴缁熺櫥褰曠殑鐢ㄦ埛鐨勫瘑鐮佷綔涓鸿繛鎺ユ暟鎹簱鐨勭殑锛屼笉鐭ラ亾鏄笉鏄繖涓晩锛?
褰撶劧鎴戜篃鐢⊿A鍜岀櫥褰曞瘑鐮佽瘯杩囧氨鏄笉琛屽晩锛佷笉鐭ラ亾鍚勪綅澶у摜浠垜杩欐牱鍋氭槸涓嶆槸鍙互鍟婏紝鎴戞槸涓垵瀛﹁€呬笉鐭ラ亾閿欏湪閭i噷浜?

#37


drugon(personal) 锛氱敤ODBC濡備綍鍐欎綘鑳藉府鎴戝啓涓€涓垜璇曡瘯鐪嬭兘涓嶈兘杩烇紵

#38


璋㈣阿澶у鐨勶紝鎻愮ず鍟婏紝鎴戞妸椹卞姩绋嬪簭鏀规垚JDBC-ODBC杩炴帴灏卞彲浠ヤ簡锛屽彧鏄綋鎴戣緭鍏ョ敤鎴峰悕锛屽杈撳叆閿欏氨鍙槸杈惧埌瑕佹眰锛屼絾鏄緭鍏ellking涔熷氨鏄緭鍏ユ纭殑鐢ㄦ埛鍚嶄笌瀵嗙爜鏃讹紝灏辨彁绀哄涓嬮敊璇紝涓嶇煡閬撻敊鍦ㄥ摢 閲岋紵
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]鏃犳晥鐨勬弿杩扮绱㈠紩
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.login_jsp._jspService(login_jsp.java:123)
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)
com.jspdev.ch8.EncodingFilter.doFilter(EncodingFilter.java:36)


root cause 

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]鏃犳晥鐨勬弿杩扮绱㈠紩
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3908)
sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5702)
sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:356)
sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:413)
org.apache.jsp.login_jsp._jspService(login_jsp.java:97)
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)
com.jspdev.ch8.EncodingFilter.doFilter(EncodingFilter.java:36)


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


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

Apache Tomcat/5.0.28

#39


statement.execute("update user_info set userLogCount="+count+",userLastLogTime='"+sqltime+"' where userId='" + id +"'");
   鎵ц杩欏彞鏃舵湁闂鍚?nbsp;
  鍓嶉潰浣犱笉鏄?nbsp;statement.close() 浜嗗悧

#40


椋炴€濋偅鏈琷sp涔︿笂鐨勪唬鐮佹病鏈夎兘鎴愬姛鐨?鏈€濂借嚜宸变竴姝ヤ竴姝ュ仛.閭f湰涔﹀彧鑳藉仛涓哄弬鑰?

#41


閭d笁涓枃浠舵斁涓€濂楀埌\jdk\jre\lib\ext涓嬮潰锛岃繕鏈夋祴璇曟椂鏈€濂藉皯鍐欐敞閲婏紝鍚﹀垯鏈夊彲鑳介亣鍒板啿绐侊紝锛堝ぉ鍙€滆锛岃繖绉嶉棶棰樹亢閬囪杩囷級銆傛垜鐨勯┍鍔ㄦ斁鍒皌omcat閲屾牴鏈笉琛岋紝鎴戜篃涓嶇煡閬撲负浠€涔堛€?

#42


鍚屾劅鍟婏紝鎴戝氨鏄敤椋炴€濈浜岀増鍟婏紝瑙夌殑濂藉浠g爜閿欙紵

#43


锛滐紞锛嶏紞锛嶏紞锛嶏紞锛嶏紞锛嶏紞锛嶏紞锛嶉珮鎵嬬湅杩囨潵锛?nbsp;鑳戒笉鑳芥悶瀹氳繖涓紵
http://community.csdn.net/Expert/topic/3472/3472337.xml?temp=.2961847

#44


棣栧厛璺熶綘璇翠竴鐐?
   鍦╯ql server 2000涓? 濡傛灉浣犳槸鐢ㄧ櫥闄嗙郴缁熺殑甯愬彿鍘绘墦寮€鏁版嵁搴撶殑鏄笉琛岀殑,浣犲憜浠ユ墦寮€鏄洜涓虹殑浣犳暟鎹簱瓒呯骇鐢ㄦ埛sa娌℃湁璁剧疆瀵嗙爜,鎵€浠ヤ綘鍙互鎵撳紑.浣嗘槸鍦ㄧ敤ODBC鐨勬椂鍊欏氨涓嶈浜?瀹冭姹備綘杈撳叆瀵嗙爜,鎴戜互鍓嶈瘯杩?鏄笉琛岀殑.鐜板湪娌¤瀹?鎵€浠ュ氨涓嶇煡閬撲簡,涓嶇煡閬撴湁娌℃湁浜鸿瘯杩囨垚鍔熶簡鐨?
  浣嗘槸鍦╯ql server 2000涓張鏈夐偅涓€椤?鍙互鐢ㄧ櫥闄嗙郴缁熺殑甯愬彿鍘荤櫥闄嗘暟鎹簱.閭h鍦ㄦ暟鎹簱涓仛鐩稿簲鐨勮缃墠鍙互.涓嶈缃槸涓嶈浜?
 鐧婚檰绯荤粺鐨勫笎鍙峰拰鐧婚檰鏁版嵁搴撶殑甯愬彿鏄袱鍥炰簨,鏄笉涓€鏍风殑.SQL Server 2000鐨勮秴绾х敤鎴峰悕鏄痵a ,瀹冪殑鍚嶅瓧鏄笉鑳芥洿鏀圭殑.灏辫薄windows鐨刟dministrator甯愬彿涓€鏍?nbsp;(unix涓槸root).
 涓嬮潰鎴戠粰涓€涓狾DBC-JDBC鐨勪緥瀛愬亣璁句綘鍏堝湪"鎺у埗闈㈡澘"涓殑"绠$悊宸ュ叿"涓殑"ODBC鏁版嵁婧?涓繁缁忓缓浜嗕竴涓悕瀛椾负"DataBase"鐨?绯荤粺DNS鏁版嵁婧?.瀹冪殑鐢ㄦ埛鍚嶄负"test",瀵嗙爜涔熶负"test".鍋囪瀹冭繛鎺ョ殑鏄竴涓猘ccess,瀹冨叾涓殑鏁版嵁搴撶殑鍚嶅瓧涓?company",鍏朵腑鏈変竴涓〃鍚嶅瓧涓?employer".

import java.sql.*;
public class  DatabaseProductName
{
public static void main(String[] args) 
{
Connection con;
Statement stat;
DatabaseMetaData meta;
ResultSet set,info,res;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException e)
{
System.out.println("Load Driver exception ->"+e);
}
try
{
con=DriverManager.getConnection("jdbc:odbc:DataBase","test","test");
meta=con.getMetaData();
System.out.println("getDatabaseProductName()->"+meta.getDatabaseProductName());
System.out.println("getSchemaTerm()  ->"+meta.getSchemaTerm() );
System.out.println("getURL()  ->"+meta.getURL() );
System.out.println("getUserName()  ->"+meta.getUserName() );
set=meta.getCatalogs();
while (set.next())
{
System.out.println("TABLE_SCHEM ->"+set.getString(1));
}  
String type[]={"TABLE"};
String column[]={"TABLE_CAT","TABLE_SCHEM","TABLE_NAME","TABLE_TYPE","REMARKS"};
info=meta.getTables(null,null,"%",type);
ResultSetMetaData me=info.getMetaData();
for (int i=1;i<=me.getColumnCount();i++)
System.out.println(me.getColumnName(i));
     while (info.next())
{
for (int i=1;i<=5;i++)
System.out.println(column[i-1]+"<----->"+info.getString(i));
System.out.println();

}
catch(SQLException e)
{
System.out.println("SQLException ->"+e);
}//&Eacute;&Iuml;&Atilde;&aelig;&micro;&Auml;&Otilde;&acirc;&ETH;&copy;&para;&frac14;&Ecirc;&Ccedil;&Ograve;&raquo;&ETH;&copy;&micro;&Atilde;&micro;&frac12;&Ecirc;&yacute;&frac34;&Yacute;&iquest;&acirc;&micro;&Auml;&ETH;&Aring;&Iuml;&cent;&micro;&Auml;,&Auml;&atilde;&iquest;&Eacute;&Ograve;&Ocirc;&sup2;&raquo;&iquest;&acute;.&Iuml;&Acirc;&Atilde;&aelig;&micro;&Auml;&Ecirc;&Ccedil;&Ograve;&raquo;&cedil;&ouml;&Iacute;锚&Otilde;&ucirc;&micro;&Auml;&Agrave;&yacute;脳&Oacute;
try
{
stat=con.createStatement();
res=stat.executeQuery("select * from employer");
while (res.next())
{
System.out.println(res.getString("name")); //name &Ecirc;&Ccedil;卤铆employer&Ouml;&ETH;&micro;&Auml;&Ograve;&raquo;&Aacute;&ETH;
System.out.println(res.getInt("age")); //age &Ecirc;&Ccedil;卤铆employer&Ouml;&ETH;&micro;&Auml;&Ograve;&raquo;&Aacute;&ETH;
.......
}
}
catch (SQLException e)
{
System.out.pintln(e);
}
finally
{
try
{
if (con!=null)
con.close();
  }
catch (SQLException e)
{
System.out.println("close exception "+e);
}
}
}
}

#45


涓嶅ソ鎰忔€濆垰鎵嶇矘璐翠唬鐮佸嚭浜嗙偣闂,閲嶆柊绮樹竴娆?

import java.sql.*;
public class  DatabaseProductName
{
  public static void main(String[] args) 
  {
      Connection con;
      Statement stat;
      DatabaseMetaData meta;
      ResultSet set,info,res;
      try
      {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      }
      catch (ClassNotFoundException e)
      {
            System.out.println("Load Driver exception ->"+e);
      }
      try
      {
           con=DriverManager.getConnection("jdbc:odbc:DataBase","test","test");
           meta=con.getMetaData();
           System.out.println("getDatabaseProductName()->"+meta.getDatabaseProductName());
           System.out.println("getSchemaTerm()  ->"+meta.getSchemaTerm() );
           System.out.println("getURL()  ->"+meta.getURL() );
           System.out.println("getUserName()  ->"+meta.getUserName() );
           set=meta.getCatalogs();
           while (set.next())
           {
                      System.out.println("TABLE_SCHEM ->"+set.getString(1));
           }  
           String type[]={"TABLE"};
           String column[]={"TABLE_CAT","TABLE_SCHEM","TABLE_NAME","TABLE_TYPE","REMARKS"};
           info=meta.getTables(null,null,"%",type);
           ResultSetMetaData me=info.getMetaData();
           for (int i=1;i<=me.getColumnCount();i++)
           System.out.println(me.getColumnName(i));
           while (info.next())
           {
                      for (int i=1;i<=5;i++)
                      System.out.println(column[i-1]+"<----->"+info.getString(i));
                      System.out.println();
          } 
     }
     catch(SQLException e)
     {
          System.out.println("SQLException ->"+e);
     }//杩欎笂闈㈢殑浣犲彲浠ヤ笉鐪?瀹冩槸寰楀埌涓€涓暟鎹簱鐨勪竴浜涗俊鎭?涓嬮潰鐨勬槸涓€涓畬鏁寸殑渚嬪瓙.
     try
     {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     }
     catch (ClassNotFoundException e)
     {
          System.out.println("Load Driver exception ->"+e);
     }  //杩欎釜try--catch鍙互涓嶈,鍥犱负鏈€涓婇潰鐨?鏀惧湪杩欓噷鏄兂鎶婁笅闈㈢殑鍋氫负涓€涓畬鏁寸殑渚嬪瓙,鏂逛究浣犺鐪?
     try
     {
          stat=con.createStatement();
          res=stat.executeQuery("select * from employer");
          while (res.next())
          {
               System.out.println(res.getString("name")); //name &Ecirc;&Ccedil;卤铆employer&Ouml;&ETH;&micro;&Auml;&Ograve;&raquo;&Aacute;&ETH;
               System.out.println(res.getInt("age")); //age &Ecirc;&Ccedil;卤铆employer&Ouml;&ETH;&micro;&Auml;&Ograve;&raquo;&Aacute;&ETH;
               .......
          }
     }
     catch (SQLException e)
     {
         System.out.pintln(e);
    }
    finally
   {
      try
      {
            if (con!=null)
                  con.close();
      }
      catch (SQLException e)
      {
            System.out.println("close exception "+e);
      }
  }
 }
}

#46


杩樻湁闂鐨勮瘽.鍔犳垜msn鍚?rogerliu@mango.cc

#1


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]Error 

establishing socket.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException

(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException

(PageContextImpl.java:758)
org.apache.jsp.login_jsp._jspService(login_jsp.java:125)
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)
com.jspdev.ch8.EncodingFilter.doFilter(EncodingFilter.java:36)


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:512)
java.sql.DriverManager.getConnection(DriverManager.java:171)
org.apache.jsp.login_jsp._jspService(login_jsp.java:81)
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)
com.jspdev.ch8.EncodingFilter.doFilter(EncodingFilter.java:36)


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


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

Apache Tomcat/5.0.28

#2


寤虹珛濂楁帴瀛楅敊,濂借薄鏄綉缁滈敊璇?

#3


鏁版嵁搴撻┍鍔ㄧ▼搴忔湁闂銆傛病鏈夋垚鍔熷缓绔嬫暟鎹簱杩炴帴銆?

#4


閭h浠€涔堝仛鍟婏紝鎴戞槸鎶奙icrosoft SQL Server 2000 Driver for JDBC瑁呭湪C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC涓嬬殑锛岃兘涓嶈兘缁欎釜鍏蜂綋鐨勮娉曞悧锛?

#5


杩樺ソ浜嗭紝鎴戠幇鍦ㄨ繕閮戒笉鐭ラ亾浠€涔堟槸杩炴帴姹?

#6


鏁版嵁搴搖rl鐨勭鍙e彿1433鏄惁姝g‘鍛紵鎶?27.0.0.1鎹㈡垚localhost鎴栬€呬綘鏈哄櫒鐨処P璇曚竴涓嬨€?

#7


鏁版嵁搴撻┍鍔ㄧ殑3JAR鏂囦欢鍔犺浇浜嗘病锛?
灏戜竴涓笉琛?

#8


鎴戞妸杩檓ssqlserver 锛?nbsp;msbase锛?nbsp;msutil杩欎笁涓枃浠堕兘鎸庡埌浜咰:\jakarta-tomcat-5.0.28\jakarta-tomcat-5.0.28\common\lib鐩笅浜嗐€?

#9


楂樻墜甯府灏忓紵鍚э紝鎴戠幇鍦ㄥ緢鎬ュ晩锛?
鎴戝疄鎵炬槸鎵句笉鍒颁粈涔堝師鍥犱簡锛屼笉鐭ラ亾閿欏湪鍝?nbsp;閲屼簡锛孧icrosoft SQL Server 2000 Driver for JDBC鎴戜篃瑁呬簡锛屼笁涓枃浠舵垜涔熸寧鍒颁簡C:\jakarta-tomcat-5.0.28\jakarta-tomcat-5.0.28\common\lib鐩笅浜嗐€傚氨鏄竴鐩磋繍琛屼笉琛屽晩锛侊紒

#10


hao濂藉儚鏄病鏈夊0鏄庨┍鍔ㄥ憖锛屼笉鐭ヤ綘鐢ㄧ殑鏄痵qlserver杩樻槸浠€涔?

#11


鎴戠敤鐨勬槸sqlserver2000 杩欎釜瑕佷笉瑕佽缃甇DBC鏁版嵁婧愬憿锛?

#12


鎶婅繖mssqlserver 锛?nbsp;msbase锛?nbsp;msutil杩欎笁涓枃浠舵斁鍒皐ebapp涓嬬殑WEB-INF/LIB涓嬭竟璇曡瘯锛?

#13


鏁版嵁搴撻┍鍔ㄧ殑闂鍛€锛?

#14


Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();


浣犲ソ鍍忓皯鍐欎簡涓滆タ鍟婏紒锛侊紒锛?

#15


浣犲皯鍐欎簡.newInstance()

#16


鏈夊晩锛屾垜鎶婅繖浜涘叏鏀惧湪include.inc閲岄潰浜?

鍒板簳閿欏湪閭i噷锛?

#17


copy杩涘幓鍚庯紝閲嶅惎杩囦簡涔堬紵

#18


閮借瘯杩囦簡锛屽ぇ瀹惰鐨勬垜閮借瘯杩囦簡锛屽氨鏄笉鐭ラ亾浠€涔堝姙鍟?

浼氫笉浼氳窡鏁版嵁搴撴斁鐨勪綅缃湁鍏崇郴鍟?

#19


鏁版嵁搴撶殑鐢ㄦ埛鍚嶏紝瀵嗙爜閮戒负绌轰箞锛?

#20


鏄晩锛屾垜鍦ㄦ寜瑁匰QLserver2000鏃跺氨娌℃湁璁剧敤鎴峰悕鍜屽瘑鐮佹墍浠ユ垜璁や负搴旀槸绌虹殑鍚э紒

#21


浼氱殑甯垜涓€涓嬪惂锛?

瑙e喅绔嬭鍏冲笎

#22


楂樻墜鍟婏紝璺眰鍟?

#23


浣犵殑杩炴帴鏁版嵁搴撶殑鐢ㄦ埛鍚嶄负绌猴紝杩欐槸涓嶈鐨勶紝鑰屼笖SQL銆€SERVER涔熶笉鏀寔绌虹敤鎴峰悕鐨勩€傜敤JDBC杩炴帴SQL銆€SERVER鐨勬椂鍊欏ソ璞$敤鎴峰悕鍜屽瘑鐮佷笉鑳戒负绌虹殑锛岀敤ODBC鐨勬椂鍊橲QL銆€SEVER灏变笉鑳芥湁绌哄瘑鐮佺殑锛屽惁鍒欒繛涓嶄笂鐨勩€備綘鍏堝啓涓€涓繛鎺ユ暟鎹簱鐨勬祴璇曠▼搴忚瘯璇曞彲椐e彲浠ョ敤绌虹殑瀵嗙爜鐨勩€傜湅鐢ㄦ埛鍚嶅拰瀵嗙爜鍙笉鍙负绌恒€?

#24


浣犲湪鎸夎SQLserver2000鏃跺氨娌℃湁璁剧敤鎴峰悕鍜屽瘑鐮侊紝骞朵笉鑳借涓哄簲鏄┖鐨勶紝SQL銆€SERVER鐨勯粯璁ょ敤鎴峰悕鏄痵a,骞朵笉鏄病鏈夌敤鎴峰悕锛屾墍浠ヤ綘鐨勭▼搴忎腑鐨刄SER鐨勫€艰鏄痵a,鍙槸浣犳病鏈夊瘑鐮侊紝瀹冪殑鍊兼墠涓虹┖銆?

#25


鏈€鍚庢槸鍦⊿QL銆€SERVER涓暟鎹簱鐨勫睘鎬т腑涓簊a鐢ㄦ埛璁剧疆涓€涓瘑鐮侊紝瑕佸畨鍏ㄤ竴浜涖€?

#26


drugon(personal锛夛細鎴戠幇宸叉妸鐢ㄦ埛鍚嶈涓簎ser鍜屽瘑鐮佷负user鍙槸杩欐牱杩樻槸涓嶈鍟婏紒

#27


浣犵湅涓€涓嬫垜鍐欑殑SQLSERVER2000鐨勮繛鎺ワ紝濡傛灉鏄繛鎺ョ殑闂锛屼綘鍏堟妸杩炴帴鍐欏埌BEAN鎴栨槸鐩存帴鍐欏埌JSP椤甸潰閲屽幓璇曚竴璇曪紝鎶婁綘鐨勮繛鎺ラ儴鍒嗘崲鎴愭垜鐨勫氨鑲畾娌℃湁闂浜嗭紙鎴戞槸鍐欏湪BEAN閲岄潰鐨勶級
public Connection connect() throws Exception {
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver")
.newInstance();
System.out.println("jdbc loading....");
String url = "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=cctest";
String user = "sa";
String password = "manager";
con = DriverManager.getConnection(url, user, password);
return con;
} catch (Exception e) {
error = "EXC:Connection to database was lost";
throw new Exception(error);
}
}


#28


杩欐牱鍐欑殑璺熼偅鏍锋湁鍏风殑鐨勫尯鍒悧锛?

#29


鎴戝師浠ヤ负鏄粈涔堥敊浜嗭紝鎴戝氨鍐嶅彟鍐欎竴涓紝鏁版嵁搴撹繛鎺ワ紝鍙槸涔熶竴鏍峰嚭鐜颁笂闈㈢殑閭f牱鍑洪敊鐨勬彁绀猴紵锛?

#30


涓嬭浇SQL Server 2000 Driver for JDBC Service Pack 3
http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en


涓嬩簡瑁呬笂鐪嬬湅

#31


妫€鏌ラ槻鐏锛宨p鍦板潃锛屽鏋滈兘娌¢棶棰橀偅灏辨槸鎿嶄綔绯荤粺鐨勪簨鍎夸簡
濡傛灉鏄痻p(sp1)浠ヤ笂鐨勭増鏈紝Service Pack 3琛ヤ竵瑁呬笂锛岃涓婁簡鍙兘浼氬ソ浣匡紝win2000浠ヤ笂鐨勬搷浣滅郴缁熻浜唖ql2000涓€鑸兘浼氬嚭鐜拌繖绉嶉棶棰橈紝褰撳垵杩欎釜闂鎶樼(浜嗘垜涓ゅぉ涓ゅ锛堟睏锛夛紒寤鸿浣犳渶濂借xp(sp1鐗?鐨勶紝杩欐槸缁堟瀬瑙e喅鍔炴硶锛侊紒锛佸墠鎻愭槸浣犺瀹宻p3琛ヤ竵鍚庝粛鐒惰繛鎺ヤ笉涓?

#32


鎴戠敤鐨勬槸XP(SP2)锛屽ソ鐨勶紝鎴戣瘯涓嬬湅琛屼笉琛岋紵

#33


鍚勪綅澶у摜鎴戣瘯浜嗚繕鏄笉琛岋紵

#34


浼拌鏄綘鐨勬暟鎹簱椹卞姩娌″紕濂?

#35


搴旇涓嶆槸椹卞姩鐨勯棶棰?
浣犵殑sa鐢ㄦ埛鐨勫瘑鐮佹槸涓嶆槸manager鍛€?
浣犲厛鐢ㄥ瘑鐮佷负manager鐨勭敤鎴穝a鐢∣DBC杩炵殑璇曡瘯鐪?濡傛灉鍙互閭e氨涓嶆槸椹卞姩鐨勯棶棰?鍙兘鏄叾瀹冪殑鍘熷洜,鎴栬€呬綘鎶妔p2鍖呭嵏鎺夎瘯璇?浠ュ墠濂借薄鐪嬪埌鍒汉涔熷嚭鐜拌繃杩欐牱鐨勯棶棰?

#36


鎴戣瘯杩囦簡杩樻槸涓嶈銆傛垜鏄敤鎴戠郴缁熺櫥褰曠殑鐢ㄦ埛鐨勫瘑鐮佷綔涓鸿繛鎺ユ暟鎹簱鐨勭殑锛屼笉鐭ラ亾鏄笉鏄繖涓晩锛?
褰撶劧鎴戜篃鐢⊿A鍜岀櫥褰曞瘑鐮佽瘯杩囧氨鏄笉琛屽晩锛佷笉鐭ラ亾鍚勪綅澶у摜浠垜杩欐牱鍋氭槸涓嶆槸鍙互鍟婏紝鎴戞槸涓垵瀛﹁€呬笉鐭ラ亾閿欏湪閭i噷浜?

#37


drugon(personal) 锛氱敤ODBC濡備綍鍐欎綘鑳藉府鎴戝啓涓€涓垜璇曡瘯鐪嬭兘涓嶈兘杩烇紵

#38


璋㈣阿澶у鐨勶紝鎻愮ず鍟婏紝鎴戞妸椹卞姩绋嬪簭鏀规垚JDBC-ODBC杩炴帴灏卞彲浠ヤ簡锛屽彧鏄綋鎴戣緭鍏ョ敤鎴峰悕锛屽杈撳叆閿欏氨鍙槸杈惧埌瑕佹眰锛屼絾鏄緭鍏ellking涔熷氨鏄緭鍏ユ纭殑鐢ㄦ埛鍚嶄笌瀵嗙爜鏃讹紝灏辨彁绀哄涓嬮敊璇紝涓嶇煡閬撻敊鍦ㄥ摢 閲岋紵
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]鏃犳晥鐨勬弿杩扮绱㈠紩
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.login_jsp._jspService(login_jsp.java:123)
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)
com.jspdev.ch8.EncodingFilter.doFilter(EncodingFilter.java:36)


root cause 

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]鏃犳晥鐨勬弿杩扮绱㈠紩
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3908)
sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5702)
sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:356)
sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:413)
org.apache.jsp.login_jsp._jspService(login_jsp.java:97)
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)
com.jspdev.ch8.EncodingFilter.doFilter(EncodingFilter.java:36)


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


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

Apache Tomcat/5.0.28

#39


statement.execute("update user_info set userLogCount="+count+",userLastLogTime='"+sqltime+"' where userId='" + id +"'");
   鎵ц杩欏彞鏃舵湁闂鍚?nbsp;
  鍓嶉潰浣犱笉鏄?nbsp;statement.close() 浜嗗悧

#40


椋炴€濋偅鏈琷sp涔︿笂鐨勪唬鐮佹病鏈夎兘鎴愬姛鐨?鏈€濂借嚜宸变竴姝ヤ竴姝ュ仛.閭f湰涔﹀彧鑳藉仛涓哄弬鑰?

#41


閭d笁涓枃浠舵斁涓€濂楀埌\jdk\jre\lib\ext涓嬮潰锛岃繕鏈夋祴璇曟椂鏈€濂藉皯鍐欐敞閲婏紝鍚﹀垯鏈夊彲鑳介亣鍒板啿绐侊紝锛堝ぉ鍙€滆锛岃繖绉嶉棶棰樹亢閬囪杩囷級銆傛垜鐨勯┍鍔ㄦ斁鍒皌omcat閲屾牴鏈笉琛岋紝鎴戜篃涓嶇煡閬撲负浠€涔堛€?

#42


鍚屾劅鍟婏紝鎴戝氨鏄敤椋炴€濈浜岀増鍟婏紝瑙夌殑濂藉浠g爜閿欙紵

#43


锛滐紞锛嶏紞锛嶏紞锛嶏紞锛嶏紞锛嶏紞锛嶏紞锛嶉珮鎵嬬湅杩囨潵锛?nbsp;鑳戒笉鑳芥悶瀹氳繖涓紵
http://community.csdn.net/Expert/topic/3472/3472337.xml?temp=.2961847

#44


棣栧厛璺熶綘璇翠竴鐐?
   鍦╯ql server 2000涓? 濡傛灉浣犳槸鐢ㄧ櫥闄嗙郴缁熺殑甯愬彿鍘绘墦寮€鏁版嵁搴撶殑鏄笉琛岀殑,浣犲憜浠ユ墦寮€鏄洜涓虹殑浣犳暟鎹簱瓒呯骇鐢ㄦ埛sa娌℃湁璁剧疆瀵嗙爜,鎵€浠ヤ綘鍙互鎵撳紑.浣嗘槸鍦ㄧ敤ODBC鐨勬椂鍊欏氨涓嶈浜?瀹冭姹備綘杈撳叆瀵嗙爜,鎴戜互鍓嶈瘯杩?鏄笉琛岀殑.鐜板湪娌¤瀹?鎵€浠ュ氨涓嶇煡閬撲簡,涓嶇煡閬撴湁娌℃湁浜鸿瘯杩囨垚鍔熶簡鐨?
  浣嗘槸鍦╯ql server 2000涓張鏈夐偅涓€椤?鍙互鐢ㄧ櫥闄嗙郴缁熺殑甯愬彿鍘荤櫥闄嗘暟鎹簱.閭h鍦ㄦ暟鎹簱涓仛鐩稿簲鐨勮缃墠鍙互.涓嶈缃槸涓嶈浜?
 鐧婚檰绯荤粺鐨勫笎鍙峰拰鐧婚檰鏁版嵁搴撶殑甯愬彿鏄袱鍥炰簨,鏄笉涓€鏍风殑.SQL Server 2000鐨勮秴绾х敤鎴峰悕鏄痵a ,瀹冪殑鍚嶅瓧鏄笉鑳芥洿鏀圭殑.灏辫薄windows鐨刟dministrator甯愬彿涓€鏍?nbsp;(unix涓槸root).
 涓嬮潰鎴戠粰涓€涓狾DBC-JDBC鐨勪緥瀛愬亣璁句綘鍏堝湪"鎺у埗闈㈡澘"涓殑"绠$悊宸ュ叿"涓殑"ODBC鏁版嵁婧?涓繁缁忓缓浜嗕竴涓悕瀛椾负"DataBase"鐨?绯荤粺DNS鏁版嵁婧?.瀹冪殑鐢ㄦ埛鍚嶄负"test",瀵嗙爜涔熶负"test".鍋囪瀹冭繛鎺ョ殑鏄竴涓猘ccess,瀹冨叾涓殑鏁版嵁搴撶殑鍚嶅瓧涓?company",鍏朵腑鏈変竴涓〃鍚嶅瓧涓?employer".

import java.sql.*;
public class  DatabaseProductName
{
public static void main(String[] args) 
{
Connection con;
Statement stat;
DatabaseMetaData meta;
ResultSet set,info,res;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException e)
{
System.out.println("Load Driver exception ->"+e);
}
try
{
con=DriverManager.getConnection("jdbc:odbc:DataBase","test","test");
meta=con.getMetaData();
System.out.println("getDatabaseProductName()->"+meta.getDatabaseProductName());
System.out.println("getSchemaTerm()  ->"+meta.getSchemaTerm() );
System.out.println("getURL()  ->"+meta.getURL() );
System.out.println("getUserName()  ->"+meta.getUserName() );
set=meta.getCatalogs();
while (set.next())
{
System.out.println("TABLE_SCHEM ->"+set.getString(1));
}  
String type[]={"TABLE"};
String column[]={"TABLE_CAT","TABLE_SCHEM","TABLE_NAME","TABLE_TYPE","REMARKS"};
info=meta.getTables(null,null,"%",type);
ResultSetMetaData me=info.getMetaData();
for (int i=1;i<=me.getColumnCount();i++)
System.out.println(me.getColumnName(i));
     while (info.next())
{
for (int i=1;i<=5;i++)
System.out.println(column[i-1]+"<----->"+info.getString(i));
System.out.println();

}
catch(SQLException e)
{
System.out.println("SQLException ->"+e);
}//&Eacute;&Iuml;&Atilde;&aelig;&micro;&Auml;&Otilde;&acirc;&ETH;&copy;&para;&frac14;&Ecirc;&Ccedil;&Ograve;&raquo;&ETH;&copy;&micro;&Atilde;&micro;&frac12;&Ecirc;&yacute;&frac34;&Yacute;&iquest;&acirc;&micro;&Auml;&ETH;&Aring;&Iuml;&cent;&micro;&Auml;,&Auml;&atilde;&iquest;&Eacute;&Ograve;&Ocirc;&sup2;&raquo;&iquest;&acute;.&Iuml;&Acirc;&Atilde;&aelig;&micro;&Auml;&Ecirc;&Ccedil;&Ograve;&raquo;&cedil;&ouml;&Iacute;锚&Otilde;&ucirc;&micro;&Auml;&Agrave;&yacute;脳&Oacute;
try
{
stat=con.createStatement();
res=stat.executeQuery("select * from employer");
while (res.next())
{
System.out.println(res.getString("name")); //name &Ecirc;&Ccedil;卤铆employer&Ouml;&ETH;&micro;&Auml;&Ograve;&raquo;&Aacute;&ETH;
System.out.println(res.getInt("age")); //age &Ecirc;&Ccedil;卤铆employer&Ouml;&ETH;&micro;&Auml;&Ograve;&raquo;&Aacute;&ETH;
.......
}
}
catch (SQLException e)
{
System.out.pintln(e);
}
finally
{
try
{
if (con!=null)
con.close();
  }
catch (SQLException e)
{
System.out.println("close exception "+e);
}
}
}
}

#45


涓嶅ソ鎰忔€濆垰鎵嶇矘璐翠唬鐮佸嚭浜嗙偣闂,閲嶆柊绮樹竴娆?

import java.sql.*;
public class  DatabaseProductName
{
  public static void main(String[] args) 
  {
      Connection con;
      Statement stat;
      DatabaseMetaData meta;
      ResultSet set,info,res;
      try
      {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      }
      catch (ClassNotFoundException e)
      {
            System.out.println("Load Driver exception ->"+e);
      }
      try
      {
           con=DriverManager.getConnection("jdbc:odbc:DataBase","test","test");
           meta=con.getMetaData();
           System.out.println("getDatabaseProductName()->"+meta.getDatabaseProductName());
           System.out.println("getSchemaTerm()  ->"+meta.getSchemaTerm() );
           System.out.println("getURL()  ->"+meta.getURL() );
           System.out.println("getUserName()  ->"+meta.getUserName() );
           set=meta.getCatalogs();
           while (set.next())
           {
                      System.out.println("TABLE_SCHEM ->"+set.getString(1));
           }  
           String type[]={"TABLE"};
           String column[]={"TABLE_CAT","TABLE_SCHEM","TABLE_NAME","TABLE_TYPE","REMARKS"};
           info=meta.getTables(null,null,"%",type);
           ResultSetMetaData me=info.getMetaData();
           for (int i=1;i<=me.getColumnCount();i++)
           System.out.println(me.getColumnName(i));
           while (info.next())
           {
                      for (int i=1;i<=5;i++)
                      System.out.println(column[i-1]+"<----->"+info.getString(i));
                      System.out.println();
          } 
     }
     catch(SQLException e)
     {
          System.out.println("SQLException ->"+e);
     }//杩欎笂闈㈢殑浣犲彲浠ヤ笉鐪?瀹冩槸寰楀埌涓€涓暟鎹簱鐨勪竴浜涗俊鎭?涓嬮潰鐨勬槸涓€涓畬鏁寸殑渚嬪瓙.
     try
     {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     }
     catch (ClassNotFoundException e)
     {
          System.out.println("Load Driver exception ->"+e);
     }  //杩欎釜try--catch鍙互涓嶈,鍥犱负鏈€涓婇潰鐨?鏀惧湪杩欓噷鏄兂鎶婁笅闈㈢殑鍋氫负涓€涓畬鏁寸殑渚嬪瓙,鏂逛究浣犺鐪?
     try
     {
          stat=con.createStatement();
          res=stat.executeQuery("select * from employer");
          while (res.next())
          {
               System.out.println(res.getString("name")); //name &Ecirc;&Ccedil;卤铆employer&Ouml;&ETH;&micro;&Auml;&Ograve;&raquo;&Aacute;&ETH;
               System.out.println(res.getInt("age")); //age &Ecirc;&Ccedil;卤铆employer&Ouml;&ETH;&micro;&Auml;&Ograve;&raquo;&Aacute;&ETH;
               .......
          }
     }
     catch (SQLException e)
     {
         System.out.pintln(e);
    }
    finally
   {
      try
      {
            if (con!=null)
                  con.close();
      }
      catch (SQLException e)
      {
            System.out.println("close exception "+e);
      }
  }
 }
}

#46


杩樻湁闂鐨勮瘽.鍔犳垜msn鍚?rogerliu@mango.cc