- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2015 02:48 PM
Hi Vida,
Thank you for your response and for your suggestion to go to this particular notebook. I got the connection now!
For future reference, these where the obstacles for me
- "You just need to use the right JDBC driver." --> Where could I find 'the right JDBC driver'? I found sqljdbc4.jar somewhere, uploaded it in 'create library' before starting the cluster (or restart cluster).
- Azure has a JDBC connection string that you can copy, there you can clearly find the parameters you need. I used this complete connection string in the "url"
- don't forget to whitelist the IP address in Azure
- I wasn't sure what to use for the 'driver'. This worked for me: "driver" -> "com.microsoft.sqlserver.jdbc.SQLServerDriver"
val resultsDF = sqlContext.load("jdbc", Map( "driver" -> "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"url" -> s"jdbc:sqlserver://xxxxx.database.windows.net:1433;database=yyyydb01;user=someuser@xxxxx;password=secret;encrypt=true; trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;", "dbtable" -> s"$t_table"))
And in a SQL Notebook: CREATE TEMPORARY TABLE jdbcTable USING org.apache.spark.sql.jdbc OPTIONS ( url "jdbc:sqlserver://xxxxx.databse.windows.net;DabaseName=yyyydb01;user=someuser;password=secret", dbtable "SalesLT.Product")
Thanks again!