我随机收到以下错误,你们能帮我解决这个问题吗????
请注意错误开始的下面的行..
[在 org.apache.jsp.jsp.getBookingUserSlots_jsp._jspService(org.apache.jsp.jsp.getBookingUserSlots_jsp:275)]
Error in dboperation getBookingUserSlots.jsp.............java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
Error in dboperation getBookingUserSlots.jsp.............[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.setupImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.<init>(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.<init>(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Source)
at org.apache.jsp.jsp.getBookingUserSlots_jsp._jspService(org.apache.jsp.jsp.getBookingUserSlots_jsp:275)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at LoginFilter.doFilter(LoginFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
String driverName111 = (String) arrLstSQLServer.get(3);
将从 context.xml 返回以下代码
<drivername>com.microsoft.jdbc.sqlserver.SQLServerDriver</drivername>
这就是我的 file.jsp 的样子
<html>
<head>
<base href="<%=basePath%>">
<title>Booking Agent Virtual Labs</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<%
HashMap hmReadXML11=new HashMap();
citbook.ReadDBSolveITXml solveitXML11=new citbook.ReadDBSolveITXml();
hmReadXML11 = solveitXML11.hmXML;
ArrayList arrLstSQLServer = (ArrayList) hmReadXML11.get("mssqlserver");
String userName = (String) arrLstSQLServer.get(0);
String userPassword = (String) arrLstSQLServer.get(1);
String url = (String) arrLstSQLServer.get(2)+";databaseName=DBNAME;user="+userName+";password="+userPassword;
String driverName111 = (String) arrLstSQLServer.get(3);
if(userPassword==null){
userPassword="";
}
userPassword = userPassword.trim();
Class.forName(driverName111).newInstance();
con11 = DriverManager.getConnection (url, userName, userPassword);
%>
</body>
</html>
用户名和密码从
上下文.xml
<mssqlserver>
<username>xxxxx</username>
<password>xxxxxxx</password>
<url>jdbc:sqlserver://192.168.X.XXX\DBINSTANCE:1305</url>
<drivername>com.microsoft.jdbc.sqlserver.SQLServerDriver</drivername>
</mssqlserver>