title: Trying to connect to Oracle from Spark
body: <p>I am trying to connect to Oracle to Spark and want pull data from some table and SQL queries. But I am not able to connect to Oracle. I have tried different work around options, but no look. I have followed the below steps. Please correct me if I need to make any changes.</p>
  
  <p>I am using Windows 7 machine.
  I using Jupyter notebook to use Pyspark.
  I have python 2.7 and Spark 2.1.0.
  I have set a spark Class path in environment variables:</p>
  
  <pre><code>  SPARK_CLASS_PATH = C:\Oracle\Product\11.2.0\client_1\jdbc\lib\ojdbc6.jar
  </code></pre>
  
  <p>jdbcDF = sqlContext.read.format("jdbc").option("driver", "oracle.jdbc.driver.OracleDriver").option("url", "jdbc:oracle://dbserver:port#/database").option("dbtable","Table_name").option("user","username").option("password","password").load()</p>
  
  <p>Errors:</p>
  
  <p>1.Py4JJavaError: </p>
  
  <pre><code>An error occurred while calling o148.load.
  : java.sql.SQLException: Invalid Oracle URL specified
  </code></pre>
  
  <p>2.Py4JJavaError: </p>
  
  <pre><code>An error occurred while calling o114.load. : java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
  </code></pre>
  
  <p>Another Scenario:</p>
  
  <pre><code>  from pyspark import SparkContext, SparkConf
      from pyspark.sql import SQLContext
      ORACLE_DRIVER_PATH = "C:\Oracle\Product\11.2.0\client_1\jdbc\lib\ojdbc7.jar"                                            
      Oracle_CONNECTION_URL ="jdbc:oracle:thin:username/password@servername:port#/dbservicename"    
     conf = SparkConf()
     conf.setMaster("local")
     conf.setAppName("Oracle_imp_exp")       
     sqlContext = SQLContext(sc)
     ora_tmp=sqlContext.read.format('jdbc').options(
          url=Oracle_CONNECTION_URL,
          dbtable="tablename",
          driver="oracle.jdbc.OracleDriver"
          ).load() 
  </code></pre>
  
  <p>I am getting below error.  </p>
  
  <pre><code>Error: IllegalArgumentException: u"Error while instantiating org.apache.spark.sql.hive.HiveSessionState':"
  </code></pre>
  
  <p>Please help me on this.</p>