title: Caused by: java.lang.IllegalArgumentException: Can't get JDBC type for null
body: <p>Getting the below error while loading <code>Null</code> value to database in spark . <code>Datatype</code> of the target table is <code>smallint</code></p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Can't get JDBC type for null
  </code></pre>
  
  <p>code :</p>
  
  <pre><code>val hivedata = spark.sql(s"""select 1 as column1 , B a column2 , NULL as column3 from table""")
  
  hivedata .write.mode(SaveMode.Append).jdbc(url = con, table = targettable, Pconnectionropertiess)
  </code></pre>
  
  <p>can anyone please help me </p>