How can I call a stored procedure in Spark Sql?

mashaye
New Contributor

I have seen the following code:

val url =
   "jdbc:mysql://yourIP:yourPort/test?
   user=yourUsername; password=yourPassword"
   val df = sqlContext
   .read
   .format("jdbc")
   .option("url", url)
   .option("dbtable", "people")
   .load()

But I need to run a stored procedure. When I use

exec
command for the
dbtable
option above, it gives me this error:

com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'exec'.