Cannot establish connection with azure sql from hive

Hi @itversity @itversity1 ,

I want to write a hive table to an azure sql database using Scala Spark.
I am using the below connection , but getting error everytime.
Can you please tell me whats missing or need to be added in the below snippet:

// Declaring the values for my Azure SQL database
val jdbcUsername = “”
val jdbcPassword = “”
val jdbcHostname = “” //typically, this is in the form or
val jdbcPort = 1433
val jdbcDatabase =""

//building a JDBC URL
import java.util.Properties

val jdbc_url = s"jdbc:sqlserver://${jdbcHostname}:${jdbcPort};database=${jdbcDatabase};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*;loginTimeout=60;"
val connectionProperties = new Properties()
connectionProperties.put(“user”, s"${jdbcUsername}")
connectionProperties.put(“password”, s"${jdbcPassword}")

//Finally, using the hive table to create a table in Azure SQL database
spark.table(“hvactable_hive”).write.jdbc(jdbc_url, “hvactable”, connectionProperties)

(note: in the " " part, i am using my db_name.table names)

Can you please suggest which driver i am missing here.

Thanks and Regards,

Learn Spark 1.6.x or Spark 2.x on our state of the art big data labs

  • Click here for access to state of the art 13 node Hadoop and Spark Cluster

1 Like

solved it,used the driver name in the connection properties and it worked