gpt4 book ai didi

java - jsp sql连接socket错误mysql server 2008R2

转载 作者:行者123 更新时间:2023-12-01 04:45:46 25 4
gpt4 key购买 nike

我随机收到以下错误,你们能帮我解决这个问题吗???

请注意以下错误开始的行..

[at 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>

最佳答案

我猜您使用了错误的驱动程序:

Error in dboperation getBookingUserSlots.jsp.............[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.

看看:Microsoft SQL Server JDBC Driver 3.0支持SQLServer2008R2

<小时/>

以下行返回什么:

String driverName111 = (String) arrLstSQLServer.get(3);

为什么要得到(3)?

关于java - jsp sql连接socket错误mysql server 2008R2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15878064/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com