问题描述
确定了端口是1433jar包也导入了驱动也装对了,但任然连接不了,求高手指点!!!具体代码如下:SunMay0801:41:35CST2011:成功注册JDBC驱动程序com.microsoft.sqlserver.jdbc.SQLServerDriverSunMay0801:41:35CST2011:成功创建连接池sqlserverSunMay0801:41:37CST2011:无法创建下列URL的连接:jdbc:sqlserver://hostlocal:1433;DatabaseName=hrmsjava.lang.NullPointerExceptionjava.lang.NullPointerExceptionathrms.user.User.ChkLogin(User.java:119)atorg.apache.jsp.ChkLogin_jsp._jspService(ChkLogin_jsp.java:108)atorg.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)atorg.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)atorg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)atorg.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)atjava.lang.Thread.run(Thread.java:662)
解决方案
解决方案二:
引用楼主bohexiaoli的回复:
SunMay0801:41:37CST2011:无法创建下列URL的连接:jdbc:sqlserver://hostlocal:1433;DatabaseName=hrms
应该是jdbc:sqlserver://localhost:1433;DatabaseName=hrms
解决方案三:
哈哈非常感谢!!!一直纠结以为是什么大问题,原来是这个错了!
解决方案四:
哈哈。localhost
解决方案五:
无法创建下列URL的连接:jdbc:sqlserver://hostlocal:1433;DatabaseName=hrms把hostlocal改为localhost吧??那么不小心..........以后看来你还地都记单词呗。。。。