title: pyspark jdbc dataframe creation using LDAP connections from Oracle
body: <p>I am trying to create pyspark jdbc dataframe using LDAP connections from Oracle.</p>
  
  <p>Below code is working for normal connection string based JDBC dataframe creation which worked.</p>
  
  <pre><code>creds = {"user":"USER_NAME",
               "password":"PASSWORD",
               "driver": "oracle.jdbc.OracleDriver"}
  
  
  connection_string = "jdbc:oracle:thin:@//hostname.com:1521/myint.domain.com"
  
  df = spark_session.read.jdbc(url=connection_string, table=query, properties=creds)
  </code></pre>
  
  <p>Now, our database configurations changed and we are supposed to use LDAP based authentication only.</p>
  
  <p>Hence I tried changing <code>connection_string</code> as below.</p>
  
  <pre><code>connection_string  = "myint"
  </code></pre>
  
  <p>But, it is throwing below issue.</p>
  
  <p><strong>py4j.protocol.Py4JJavaError: An error occurred while calling o51.jdbc.
  : java.lang.NullPointerException</strong></p>
  
  <p>Without Spark, I tried connecting using <code>cx_Oracle</code> module(python module for connecting to Oracle) for testing and it worked.</p>
  
  <p>Before:</p>
  
  <pre><code>host = 'myint.domain.com'
  ip = 'jdbc:oracle:thin:@//hostname.com'
  port = 1521
  conn = cx_Oracle.makedsn(ip, port, service_name=host)
  
  db = cx_Oracle.connect('USER_NAME', 'PASSWORD', conn)  # giving the conn object
  cursor = db.cursor()
  cursor.execute("""select * from myschema.mytable fetch first 5 rows only""")
  
  for row in cursor:
      print(row)
  </code></pre>
  
  <p>After:</p>
  
  <pre><code>db = cx_Oracle.connect('USER_NAME', 'PASSWORD', "myint")  # Now, just giving only the database
  cursor = db.cursor()
  cursor.execute("""select * from myschema.mytable fetch first 5 rows only""")
  
  for row in cursor:
      print(row)
  </code></pre>
  
  <p>I need to achieve the same in Pyspark JDBC dataframe by just passing only the database name. Please suggest what needs to be done.</p>
  
  <p>I hope this question can be applicable for scala spark as well. </p>