在网上找的一个小代码:<%@ page contentType="text/html;charset=gb2312"%>   
<%@ page import="java.sql.*"%> 
<%!
public static String getGBString(String src) {
try {
return new String(src.getBytes("ISO-8859-1"), "gb2312");
} catch (java.io.UnsupportedEncodingException e) {
return null;
}
}
%>
<html>   
<body> <%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();   
String url="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=webdisk"; 
//test你的数据库的 
String user="sa"; 
String password=""; 
Connection conn= DriverManager.getConnection(url,user,password);   
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);   
String sql="select * from oplog";   
ResultSet rs=stmt.executeQuery(sql);   
while(rs.next()) {%>   
您的第一个字段内容为:<%=getGBString(rs.getString(1))%>   <br>
您的第二个字段内容为:<%=getGBString(rs.getString(2))%>   <br>
<%}%>   
<%out.print("数据库操作成功,恭喜你");%>   <br>
<%rs.close();   
stmt.close();   
conn.close();   
%>   
</body>   
</html> 
我的SQL2000装的是开发版,数据库webdisk是可以使用的,user和password也是正确的。现在报错信息是:
HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception javax.servlet.ServletException: [Microsoft][SQLServer JDBC Driver]Error establishing socket.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.db2000test_jsp._jspService(db2000test_jsp.java:94)
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 JDBC Driver]Error establishing socket.
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.db2000test_jsp._jspService(db2000test_jsp.java:64)
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.怎么解决阿,谢谢各位高手阿!在线等!