title: Databricks JDBC Connections works but query fails
body: <p>I am trying to build a connection to a SQL Server database through Azure Databricks. While there are a number of questions <a href="https://docs.microsoft.com/en-us/answers/questions/251843/unable-to-connect-to-azure-sql-database-through-da.html" rel="nofollow noreferrer">attempting to alleviate issues</a> here, I have yet to find a solution for mine.</p>
  <p>I am able to connect, at least it seems because the DataFrame (spark) object reads the exact schema from my database table, yet in attempting to look at the data (<code>display(df)</code> or <code>df.show()</code>) it throws a connection error.</p>
  <p>Here is how I'm connecting:</p>
  <pre><code>jdbcUrl = &quot;jdbc:sqlserver://{}:{};database={}&quot;.format(jdbcHostname, jdbcPort, jdbcDatabase)
  
  connectionProperties = {
    'user': jdbcUsername,
    'password': jdbcPassword,
    &quot;driver&quot; : &quot;com.microsoft.sqlserver.jdbc.SQLServerDriver&quot;
  }
  
  pushdown_query = &quot;(select * from persons where personid = 3040) Person&quot;
  df = spark.read.jdbc(url=jdbcUrl, table=pushdown_query, properties=connectionProperties)
  display(df)
  </code></pre>
  <p>I can see the object <code>df</code> and it correctly identifies all 47 fields in the table (see below photo), but <code>display(df)</code> throws the following error:</p>
  <pre><code>SQLServerException: The TCP/IP connection to the host hornets-sql.westus.cloudapp.azure.com, port 1433 has failed. Error: &quot;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.&quot;.
  </code></pre>
  <p><a href="https://i.stack.imgur.com/7thgG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7thgG.png" alt="enter image description here" /></a></p>