MS SQL server error

0
Having the following error when configuring an Microsoft SQL Server database:   Opening JDBC connection to Some(C13183XX\MSSQLSERVER1) failed with SQLState: 08S01 Error code: 0 Message: The connection to the host C13183XX, named instance MSSQLSERVER1 failed. Error: "java.net.SocketTimeoutException: 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. Retrying...(1/4)   Any help? thanks
asked
2 answers
1

The error describes the issue (the app can't reach the database at the address provided). If this is a new install of SQL server, you may need to open a firewall or enable TCP connections to SQL Server:

https://support.timextender.com/hc/en-us/articles/360042584612-Enable-Remote-Connections-to-SQL-Server-using-IP-address

https://docs.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-ver15

 

answered
0

Your Java socket shows SocketTimeoutException means that it takes too long to get respond from other device and your request expires before getting response. This exception is occurring on following condition.

  • Server is slow and default timeout is less, so just put timeout value according to you.
  • Server is working fine but timeout value is for less time. so change the timeout value.

Solution: A developer can pre-set the timeout option for both client and server operations.

From Client side:

Socket socket = new Socket();
SocketAddress socketAddress = new InetSocketAddress(host, port);
socket.connect(socketAddress, 12000); //12000 are milli seconds

From Server side:

ServerSocket serverSocket = new new ServerSocket(port);
serverSocket.setSoTimeout(12000);

 

answered