Remote SQL Server Instance Connection using JDBC

Upendra_Dwivedi
Databricks Partner

Hi All,

I am connecting Remote SQL Server Instance using JDBC Driver, I have enabled TCP/IP and Setup the Firewall Rule. When i am querying the instance i am getting this error:

(com.microsoft.sqlserver.jdbc.SQLServerException) The TCP/IP connection to the host 192.168.x.x, port 1433 has failed. Error: "Connect timed out. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall."

Here is my code:

remote_table = (
    spark.read
    .format("sqlserver")
    .option("host", "192.168.x.x")
    .option("port", "1433")
    .option("user", "xxxx")
    .option("password", "xxxxxxxxx")
    .option("database", "PRACTICE")
    .option("dbtable", "dbo.TblGender")
    .load()
)

remote_table.show()
 
My question is:
1. I am using ipv4 address of my personal computer as host, so is it correct?
2. If i am using the server name as host i am getting the same error.
 
If everything is correct then what could be the problem?
 
Thanks,
Upendra Dwivedi