Solution of - PRsBlog
Home >> Java >> Solution of

Solution of

While I returned to eclipse to test a simple jdbc related program after couple of months, I encountered some kind of error.

Let’s have look at my code.

Now While running this program I got following exception in console.

Exception in thread “main” The connection to the host localhost, named instance sqlexpress failed. Error: “ Receive timed out”. Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at TestDB.main(


Now I do as per the instruction in the error.

  1. Server name is fine. localhost or Name of pc is fine for server name. or run this code in Sqlserver.
    This code will display name of server
  2. Instance name: It is very difficult to  find instance name for me. After checking a manual i find a code to find instance name;
    This code will print name of instance.

    After executing these code I got – MSSQLSERVER as instance name.

I replaced SQLEXPRESS by MSSQLSERVER and my code run fine.

Do not forget to revert with your feedback and suggestions.

About Log Raj Bhatt

A Computer Science Student and Java Developer.

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest