<?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 Re: Cannot connect to SQL Warehouse using JDBC connector in Spark in Warehousing &amp; Analytics</title>
    <link>https://community.databricks.com/t5/warehousing-analytics/cannot-connect-to-sql-warehouse-using-jdbc-connector-in-spark/m-p/59346#M1160</link>
    <description>&lt;P&gt;Hi Kaniz, thanks for your reply.&lt;/P&gt;&lt;P&gt;I'm fairly certain the dbtable configuration is set correctly. The stack trace states that this query is being used:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT * FROM `default`.`user_cv_table` WHERE 1=0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However I'm not sure where that is coming from. I'm not submitting that query, wherever that query is being constructed seems to be dropping the dbtable configuration field. My best guess is that it is coming from this line:&lt;BR /&gt;&lt;STRONG&gt;at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.getQueryOutputSchema(JDBCRDD.scala:64)&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note that my error is the same as previous question here:&lt;BR /&gt;&lt;A href="https://community.databricks.com/t5/warehousing-analytics/aws-glue-and-databricks/td-p/4679" target="_blank"&gt;https://community.databricks.com/t5/warehousing-analytics/aws-glue-and-databricks/td-p/4679&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/26078"&gt;@Debayan&lt;/a&gt;&amp;nbsp;you mention there that the dbtable is not supported, this seems to be the same situation here?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Feb 2024 02:27:49 GMT</pubDate>
    <dc:creator>JustinM</dc:creator>
    <dc:date>2024-02-06T02:27:49Z</dc:date>
    <item>
      <title>Cannot connect to SQL Warehouse using JDBC connector in Spark</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/cannot-connect-to-sql-warehouse-using-jdbc-connector-in-spark/m-p/56718#M1115</link>
      <description>&lt;P&gt;When trying to connect to a SQL warehouse using the JDBC connector with Spark the below error is thrown. Note that connecting directly to a cluster with similar connection parameters works without issue, the error only occurs with SQL Warehouses.&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;py4j.protocol.Py4JJavaError: An error occurred while calling o327.run. : java.sql.SQLException: [Databricks][JDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: null, Query: SELECT * FROM `default`.`user_cv_table` WHERE 1=0, Error message from Server: Configuration dbtable is not available..&lt;BR /&gt;at com.databricks.client.hivecommon.api.HS2Client.buildExceptionFromTStatusSqlState(Unknown Source)&lt;BR /&gt;at com.databricks.client.hivecommon.api.HS2Client.buildExceptionFromTStatus(Unknown Source)&lt;BR /&gt;at com.databricks.client.hivecommon.api.HS2Client.checkResponseStatus(Unknown Source)&lt;BR /&gt;at com.databricks.client.hivecommon.api.HS2Client.executeStatementInternal(Unknown Source)&lt;BR /&gt;at com.databricks.client.hivecommon.api.HS2Client.executeStatement(Unknown Source)&lt;BR /&gt;at com.databricks.client.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.executeNonRowCountQueryHelper(Unknown Source)&lt;BR /&gt;at com.databricks.client.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.executeQuery(Unknown Source)&lt;BR /&gt;at com.databricks.client.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.&amp;lt;init&amp;gt;(Unknown Source)&lt;BR /&gt;at com.databricks.client.hivecommon.dataengine.HiveJDBCDataEngine.prepare(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.common.SPreparedStatement.&amp;lt;init&amp;gt;(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.jdbc41.S41PreparedStatement.&amp;lt;init&amp;gt;(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.jdbc42.S42PreparedStatement.&amp;lt;init&amp;gt;(Unknown Source)&lt;BR /&gt;at com.databricks.client.hivecommon.jdbc42.Hive42PreparedStatement.&amp;lt;init&amp;gt;(Unknown Source)&lt;BR /&gt;at com.databricks.client.spark.jdbc.SparkJDBCObjectFactory.createPreparedStatement(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.common.JDBCObjectFactory.newPreparedStatement(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.common.SConnection$5.create(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.common.SConnection$5.create(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.common.SConnection$StatementCreator.create(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.common.SConnection.prepareStatement(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.common.SConnection.prepareStatement(Unknown Source)&lt;BR /&gt;at com.databricks.client.jdbc.common.SConnection.prepareStatement(Unknown Source)&lt;BR /&gt;at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.getQueryOutputSchema(JDBCRDD.scala:64)&lt;BR /&gt;at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:57)&lt;BR /&gt;at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation$.getSchema(JDBCRelation.scala:239)&lt;BR /&gt;at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:36)&lt;BR /&gt;at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:350)&lt;BR /&gt;at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:274)&lt;BR /&gt;at org.apache.spark.sql.DataFrameReader.$anonfun$load$3(DataFrameReader.scala:245)&lt;BR /&gt;at scala.Option.getOrElse(Option.scala:189)&lt;BR /&gt;at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:245)&lt;BR /&gt;at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:174)&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 06:49:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/cannot-connect-to-sql-warehouse-using-jdbc-connector-in-spark/m-p/56718#M1115</guid>
      <dc:creator>JustinM</dc:creator>
      <dc:date>2024-01-09T06:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot connect to SQL Warehouse using JDBC connector in Spark</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/cannot-connect-to-sql-warehouse-using-jdbc-connector-in-spark/m-p/59346#M1160</link>
      <description>&lt;P&gt;Hi Kaniz, thanks for your reply.&lt;/P&gt;&lt;P&gt;I'm fairly certain the dbtable configuration is set correctly. The stack trace states that this query is being used:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT * FROM `default`.`user_cv_table` WHERE 1=0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However I'm not sure where that is coming from. I'm not submitting that query, wherever that query is being constructed seems to be dropping the dbtable configuration field. My best guess is that it is coming from this line:&lt;BR /&gt;&lt;STRONG&gt;at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.getQueryOutputSchema(JDBCRDD.scala:64)&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note that my error is the same as previous question here:&lt;BR /&gt;&lt;A href="https://community.databricks.com/t5/warehousing-analytics/aws-glue-and-databricks/td-p/4679" target="_blank"&gt;https://community.databricks.com/t5/warehousing-analytics/aws-glue-and-databricks/td-p/4679&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/26078"&gt;@Debayan&lt;/a&gt;&amp;nbsp;you mention there that the dbtable is not supported, this seems to be the same situation here?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 02:27:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/cannot-connect-to-sql-warehouse-using-jdbc-connector-in-spark/m-p/59346#M1160</guid>
      <dc:creator>JustinM</dc:creator>
      <dc:date>2024-02-06T02:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot connect to SQL Warehouse using JDBC connector in Spark</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/cannot-connect-to-sql-warehouse-using-jdbc-connector-in-spark/m-p/63012#M1229</link>
      <description>&lt;P&gt;I am also facing the same issue, while writing to hive_metastore table. In notebook spark.sql and saveAsTable work but in the spark job nothing seems to be working with the SQL warehouse&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 08:29:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/cannot-connect-to-sql-warehouse-using-jdbc-connector-in-spark/m-p/63012#M1229</guid>
      <dc:creator>akhileshp</dc:creator>
      <dc:date>2024-03-08T08:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot connect to SQL Warehouse using JDBC connector in Spark</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/cannot-connect-to-sql-warehouse-using-jdbc-connector-in-spark/m-p/67112#M1285</link>
      <description>&lt;P&gt;Same error here, I am trying to save spark dataframe to Delta lake using JDBC driver and pyspark using this code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#Spark session
spark_session = SparkSession.builder \
          .appName("RCT-API") \
          .config("spark.metrics.namespace", "rct-api") \
          .config("spark.driver.extraClassPath", "/opt/workspace/databricks-jdbc-2.6.34-sources.jar") \
          .config("spark.driver.extraLibrary", "/opt/workspace/databricks-jdbc-2.6.34-sources.jar") \
          .config("spark.sql.execution.arrow.pyspark.enabled", "true") \
          .config("spark.jars.packages", "com.databricks:databricks-jdbc:2.6.36") \
          .getOrCreate()

#Loading spark dataframe from pandas dataframe
spark_df = spark_session.createDataFrame(pandas_df)

# Saving design table to DeltaLake
spark_df.write.format("jdbc").options(
                url= connection_string,
                driver= "com.databricks.client.jdbc.Driver",
                dbtable= table_name).mode('overwrite').save()&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I am facing the following error:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Caused by: com.databricks.client.support.exceptions.ErrorException: [Databricks][JDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: 42601, Query: CREATE TAB***, Error message from Server: org.apache.hive.service.cli.HiveSQLException: Error running query: [PARSE_SYNTAX_ERROR] org.apache.spark.sql.catalyst.parser.ParseException:&lt;BR /&gt;[PARSE_SYNTAX_ERROR] Syntax error at or near '"id"'. SQLSTATE: 42601 (line 1, pos 33)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Any idea?&amp;nbsp;This configuration worked with general purpose clusters, but not SQL warehouses&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 18:58:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/cannot-connect-to-sql-warehouse-using-jdbc-connector-in-spark/m-p/67112#M1285</guid>
      <dc:creator>jmms</dc:creator>
      <dc:date>2024-04-23T18:58:27Z</dc:date>
    </item>
  </channel>
</rss>

