question

abhishek6555 avatar image
0 Votes"
abhishek6555 asked ·

TCP IP CONNECTION O THE HOST PORT HAS FAILED

I am trying to connect to Azure SQL database on PAAS environment. This is required to write data from Databricks to azure SQL database and also read data from Azure SQL database.
When i run the connection string and try to connect to a table present in SQL database using datbricks get the below error message. Do i need to open ports on SQL server database side and also how databricks can read data from SQL database. Are their any reference articles.

Error message : SQL server Exception : The TCP/IP connection to the host port has failed. Verify the connection properties.. Make sure that the instance of SQL server is running on the host and accepting TCP/IP connnectionss at the port . Make sure that the TCP connecstions to the port are not blocked by a firewall.

azure-databricks
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Are you connecting to Azure SQL DB or On prem SQL ? If it is Azure SQL, make sure server name and DB name is correct and fully sql server name is given

0 Votes 0 ·

It is Azure SQL database on PAAS. I have added the correct name but still giving me the same error

0 Votes 0 ·

1 Answer

PRADEEPCHEEKATLA-MSFT avatar image
0 Votes"
PRADEEPCHEEKATLA-MSFT answered ·

Hello @abhishek6555,

Can you ensure that you have the Allow connections from Azure services enabled on both the Azure Databricks instance and the Azure SQL database instance? It is likely that this is not enabled for the Azure SQL Database and thus the connection fails.

This article covers how to use the DataFrame API to connect to SQL databases using JDBC and how to control the parallelism of reads through the JDBC interface.


Step1: Establish connectivity to SQL Server

76270-image.png

Step2: Check connectivity and red & write from/to JDBC.

76304-image.png

Hope this helps. Do let us know if you any further queries.


Please don’t forget to Accept Answer and Up-Vote wherever the information provided helps you, this can be beneficial to other community members.



image.png (71.6 KiB)
image.png (135.4 KiB)
· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @abhishek6555,

Just checking in to see if the above answer helped. If this answers your query, do click Accept Answer and Up-Vote for the same. And, if you have any further query do let us know.

0 Votes 0 ·

Hello @abhishek6555,
Following up to see if the above suggestion was helpful. And, if you have any further query do let us know.
Take care & stay safe!

0 Votes 0 ·