wood burning stoves 2.0*
The moose likes JDBC and the fly likes com.microsoft.sqlserver.jdbc.SQLServerException:The TCP/IP connection to the host port 1433 has fail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "com.microsoft.sqlserver.jdbc.SQLServerException:The TCP/IP connection to the host port 1433 has fail" Watch "com.microsoft.sqlserver.jdbc.SQLServerException:The TCP/IP connection to the host port 1433 has fail" New topic
Author

com.microsoft.sqlserver.jdbc.SQLServerException:The TCP/IP connection to the host port 1433 has fail

Tusshar Fasate
Ranch Hand

Joined: May 21, 2008
Posts: 81
Hi,
I dont know this is the right forum to put this problem.
I have been facing this problem since long time whenever I try to connect to sql server from java but managed somehow to solve this many times.
But I dont know the exact reason behind this.I am not getting solution this time.
If somebody can help me on this then his/her help will be highly appreciated.
I have enabled TCP/IP of configuration manager.
The exact stack trace is as follows,

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host LTIB322/SQLEXPRESS, port 1433 has failed. Error: "null. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:170)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1049)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:833)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:716)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.jpmc.common.dao.SqlDAOFactory.createConnection(SqlDAOFactory.java:33)
at com.jpmc.user.dao.UserDAO.fetchProject(UserDAO.java:132)
at com.jpmc.schedular.SchedularPreRequisite.getProjectListWithReports(SchedularPreRequisite.java:25)
at com.jpmc.schedular.ReportsGenWithCronSchedular.init(ReportsGenWithCronSchedular.java:39)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:518)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1473)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:250)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:574)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1527)
at java.lang.Thread.run(Unknown Source)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The error message asks you to confirm that the host LTIB322/SQLEXPRESS is running SQL Server listening on port 1433. Have you indeed confirmed this? You might need to ask an administrator, or you could at least check using "telnet" to see if you can connect to that port.


[Jess in Action][AskingGoodQuestions]
Tusshar Fasate
Ranch Hand

Joined: May 21, 2008
Posts: 81
Thanks for reply.
SQl server instance is working on host.I can connect it through management studio.
I think this is problem with some setting of sql server.
Please suggest some solution related that.
Tusshar Fasate
Ranch Hand

Joined: May 21, 2008
Posts: 81
Please somebody reply.
Its urgent!!

Thanks
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Is that server configured to accept connections over TCP/IP? By default SQL Server 2005 up is not.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Tusshar Fasate
Ranch Hand

Joined: May 21, 2008
Posts: 81
I got the solution on this.
URL should be like this
jdbc:sqlserver://LTIB322\\SQLEXPRESS;Database=RGT_DEV1

I was doing like
jdbc:sqlserver://LTIB322\SQLEXPRESS;Database=RGT_DEV1 or

jdbc:sqlserver://LTIB322/SQLEXPRESS;Database=RGT_DEV1

Now its working.
But I couldnt understand why it was giving error related to TCP/IP.
It should be somewhat like unknown host some thing.
Ok....I am happy as my problem got solved.

Thanks folk for replying to my thread.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

Thank you for posting your solution.


OCUP UML fundamental and ITIL foundation
youtube channel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: com.microsoft.sqlserver.jdbc.SQLServerException:The TCP/IP connection to the host port 1433 has fail
 
Similar Threads
SQLServerException - could not connect to the host on port 1433
TCP/IP connection to the host localhost, port 1433 has failed
SQL Database to Java using JDBC
SQL Server 2000 connectivity error
Exception during connecting to sql server2005