<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SQL Server Connection on LTS 14.3 in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sql-server-connection-on-lts-14-3/m-p/76722#M35305</link>
    <description>&lt;P&gt;Hi, what is the best way to connect to a SQL Server on LTS 14.3?&lt;/P&gt;&lt;P&gt;I've been trying to setup a connection to an SQL Server as referenced &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/connect/external-systems/sql-server" target="_self"&gt;here&lt;/A&gt;. However both using both "sqlserver" and "jdbc" as format has resulted in an exception when using display as spark will send a LIMIT clause to the SQL Server. Reading the data and counting seems to work fine.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;df_jdbc = (spark.read.format('jdbc') \
            .option('driver', 'com.microsoft.sqlserver.jdbc.SQLServerDriver') \
            .option('url', jdbc_url) \
            .option('user', sql_server_user) \
            .option('password', sql_server_password) \
            .option("dbtable", 'dbo.TestTable') \
            .load())

df_jdbc.display()
# com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '10001'.

df = (spark.read.format('sqlserver') \
            .option('host', sql_server_host) \
            .option('port', sql_server_port) \
            .option('database', sql_server_database) \
            .option('user', sql_server_user) \
            .option('password', sql_server_password) \
            .option("dbtable", 'dbo.TestTable')
            .load())

df.display()
# com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '10001'.

# Query send by spark in both queries: SELECT TestColumn FROM dbo.TestTable     LIMIT 10001 &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jul 2024 08:44:13 GMT</pubDate>
    <dc:creator>fk5</dc:creator>
    <dc:date>2024-07-04T08:44:13Z</dc:date>
    <item>
      <title>SQL Server Connection on LTS 14.3</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-server-connection-on-lts-14-3/m-p/76722#M35305</link>
      <description>&lt;P&gt;Hi, what is the best way to connect to a SQL Server on LTS 14.3?&lt;/P&gt;&lt;P&gt;I've been trying to setup a connection to an SQL Server as referenced &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/connect/external-systems/sql-server" target="_self"&gt;here&lt;/A&gt;. However both using both "sqlserver" and "jdbc" as format has resulted in an exception when using display as spark will send a LIMIT clause to the SQL Server. Reading the data and counting seems to work fine.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;df_jdbc = (spark.read.format('jdbc') \
            .option('driver', 'com.microsoft.sqlserver.jdbc.SQLServerDriver') \
            .option('url', jdbc_url) \
            .option('user', sql_server_user) \
            .option('password', sql_server_password) \
            .option("dbtable", 'dbo.TestTable') \
            .load())

df_jdbc.display()
# com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '10001'.

df = (spark.read.format('sqlserver') \
            .option('host', sql_server_host) \
            .option('port', sql_server_port) \
            .option('database', sql_server_database) \
            .option('user', sql_server_user) \
            .option('password', sql_server_password) \
            .option("dbtable", 'dbo.TestTable')
            .load())

df.display()
# com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '10001'.

# Query send by spark in both queries: SELECT TestColumn FROM dbo.TestTable     LIMIT 10001 &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 08:44:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-server-connection-on-lts-14-3/m-p/76722#M35305</guid>
      <dc:creator>fk5</dc:creator>
      <dc:date>2024-07-04T08:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server Connection on LTS 14.3</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-server-connection-on-lts-14-3/m-p/76745#M35309</link>
      <description>&lt;P&gt;Bit weird, I've tested option with format('sqlserver') and I didn't notice any problems on LTS 14.3. Did you check what happens if you use databricks specific display command, like so:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;display(df)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Slash_0-1720089847300.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/9200iDEB4AAB115E1ADAD/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Slash_0-1720089847300.png" alt="Slash_0-1720089847300.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 10:46:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-server-connection-on-lts-14-3/m-p/76745#M35309</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2024-07-04T10:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server Connection on LTS 14.3</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-server-connection-on-lts-14-3/m-p/76770#M35313</link>
      <description>&lt;P&gt;In this instance neither df.display() or display(df) does work because in the end both will return the same sql to SQL Server. However I noticed it seems to be an error in the config of our cluster as it does work fine on a new compute.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably has to do with the custom dialect we are using to map TimestampType to datetime2.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 14:20:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-server-connection-on-lts-14-3/m-p/76770#M35313</guid>
      <dc:creator>fk5</dc:creator>
      <dc:date>2024-07-04T14:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server Connection on LTS 14.3</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-server-connection-on-lts-14-3/m-p/76994#M35368</link>
      <description>&lt;P&gt;Cool, I'm glad that you were able to pinpoint the issue.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jul 2024 13:54:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-server-connection-on-lts-14-3/m-p/76994#M35368</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2024-07-06T13:54:51Z</dc:date>
    </item>
  </channel>
</rss>

