I need my scala script to read the table name from user and load it .
Can I know how ?
val x = sqlContext.read.format("jdbc").option("driver","oracle.jdbc.driver.OracleDriver").option("url","jdbc:oracle:......").option("dbtable", "my_table").load();
Where is the table name coming from? In your case, is the user able to specify this (either manually or through code) when the job is submitted? If so, you can have the user specify the table name (and any other parameters) as a command line argument, such as:
./bin/spark-submit --class classname project.jar your_table_name
Reference this within your scala code to read in your argument(s):
val my_table = args(0)