<?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 Not able to fetch data from Simba Spark Jdbc Driver in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/not-able-to-fetch-data-from-simba-spark-jdbc-driver/m-p/17693#M11657</link>
    <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;We are getting below error when we tried to set the date in preparedstatement using Simba Spark Jdbc Driver.&lt;/P&gt;
&lt;P&gt;Exception:&lt;/P&gt;
&lt;P&gt;Query execution failed: [Simba][SparkJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: org.apache.hive.service.cli.HiveSQLException: Error running query: org.apache.spark.sql.AnalysisException: cannot resolve 'CAST(`col1` AS DATE)' due to data type mismatch: cannot cast int to date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;To convert values from int to date, you can use function DATE_FROM_UNIX_DATE instead.&lt;P&gt;&lt;/P&gt;; line 1 pos 0;
&lt;P&gt;Code :&lt;/P&gt;
&lt;P&gt;preparedstatement.setDate(java.sql.Date.of(dateFormatString))&lt;/P&gt;
&lt;P&gt;DateFormat used to set is : 'yyyy-MM-dd'&lt;/P&gt;
&lt;P&gt;Below is the generated sql resulting the error.&lt;/P&gt;
&lt;P&gt;INSERT INTO TABLE &lt;PRE&gt;&lt;CODE&gt;crud_test&lt;/CODE&gt;&lt;/PRE&gt;.&lt;PRE&gt;&lt;CODE&gt;dcdaeraver&lt;/CODE&gt;&lt;/PRE&gt; VALUES ( 2021-06-01 , 'Tuesday' , 'June' , 'Q_2' , '2021' , 3 , 1 , 1 , 1 , TRUE , 'June 2021' , 'Q_2 2021' , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 ) , ( 2021-06-02 , 'Wednesday' , 'June' , 'Q_2' , '2021' , 4 , 1 , 1 , 1 , TRUE , 'June 2021' , 'Q_2 2021' , 2 , 2 , 2 , 1 , 1 , 1 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 )&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 06:22:56 GMT</pubDate>
    <dc:creator>Devaraj</dc:creator>
    <dc:date>2021-07-15T06:22:56Z</dc:date>
    <item>
      <title>Not able to fetch data from Simba Spark Jdbc Driver</title>
      <link>https://community.databricks.com/t5/data-engineering/not-able-to-fetch-data-from-simba-spark-jdbc-driver/m-p/17693#M11657</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;We are getting below error when we tried to set the date in preparedstatement using Simba Spark Jdbc Driver.&lt;/P&gt;
&lt;P&gt;Exception:&lt;/P&gt;
&lt;P&gt;Query execution failed: [Simba][SparkJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: org.apache.hive.service.cli.HiveSQLException: Error running query: org.apache.spark.sql.AnalysisException: cannot resolve 'CAST(`col1` AS DATE)' due to data type mismatch: cannot cast int to date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;To convert values from int to date, you can use function DATE_FROM_UNIX_DATE instead.&lt;P&gt;&lt;/P&gt;; line 1 pos 0;
&lt;P&gt;Code :&lt;/P&gt;
&lt;P&gt;preparedstatement.setDate(java.sql.Date.of(dateFormatString))&lt;/P&gt;
&lt;P&gt;DateFormat used to set is : 'yyyy-MM-dd'&lt;/P&gt;
&lt;P&gt;Below is the generated sql resulting the error.&lt;/P&gt;
&lt;P&gt;INSERT INTO TABLE &lt;PRE&gt;&lt;CODE&gt;crud_test&lt;/CODE&gt;&lt;/PRE&gt;.&lt;PRE&gt;&lt;CODE&gt;dcdaeraver&lt;/CODE&gt;&lt;/PRE&gt; VALUES ( 2021-06-01 , 'Tuesday' , 'June' , 'Q_2' , '2021' , 3 , 1 , 1 , 1 , TRUE , 'June 2021' , 'Q_2 2021' , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 ) , ( 2021-06-02 , 'Wednesday' , 'June' , 'Q_2' , '2021' , 4 , 1 , 1 , 1 , TRUE , 'June 2021' , 'Q_2 2021' , 2 , 2 , 2 , 1 , 1 , 1 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 , 1 , 2021-06-01 , 2021-06-03 )&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 06:22:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/not-able-to-fetch-data-from-simba-spark-jdbc-driver/m-p/17693#M11657</guid>
      <dc:creator>Devaraj</dc:creator>
      <dc:date>2021-07-15T06:22:56Z</dc:date>
    </item>
  </channel>
</rss>

