Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

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

$
0
0
I am trying to connect to SQL Server 2005 Express with JDBC.   I am getting the following exception:
Code Snippet
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
            "databaseName=IFC3;";
        // Declare the JDBC objects.
        Connection con = null;
        Statement stmt = null;
        ResultSet rs = null;
       
            try {
                // Establish the connection.
                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                    con = DriverManager.getConnection(connectionUrl,"ifc2","password");




com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host  has failed. java.net.ConnectException: Connection refused: connect
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at connectURL.main(connectURL.java:43)

I am using the code example that came from Microsoft for making a JDBC connection.  I looked at my configuration of SQL Server and change to use a static port 1433.   I shut off Windows firewall to make sure it was not blocking communication.


When I try to telnet to port 1433 it says


Connecting To 1433...Could not open connection to the host, on port 23: Connect
failed


Any suggestions?
Thanks,
Tom

Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>