title: No suitable driver found for jdbc in Spark
body: <p>I am using</p>
  
  <pre><code>df.write.mode("append").jdbc("jdbc:mysql://ip:port/database", "table_name", properties)
  </code></pre>
  
  <p>to insert into a table in MySQL.</p>
  
  <p>Also, I have added <code>Class.forName("com.mysql.jdbc.Driver")</code> in my code.</p>
  
  <p>When I submit my Spark application:</p>
  
  <pre><code>spark-submit --class MY_MAIN_CLASS
    --master yarn-client
    --jars /path/to/mysql-connector-java-5.0.8-bin.jar
    --driver-class-path /path/to/mysql-connector-java-5.0.8-bin.jar
    MY_APPLICATION.jar
  </code></pre>
  
  <p>This yarn-client mode works for me.</p>
  
  <p>But when I use yarn-cluster mode:</p>
  
  <pre><code>spark-submit --class MY_MAIN_CLASS
    --master yarn-cluster
    --jars /path/to/mysql-connector-java-5.0.8-bin.jar
    --driver-class-path /path/to/mysql-connector-java-5.0.8-bin.jar
    MY_APPLICATION.jar
  </code></pre>
  
  <p>It doens't work. I also tried setting "--conf":</p>
  
  <pre><code>spark-submit --class MY_MAIN_CLASS
    --master yarn-cluster
    --jars /path/to/mysql-connector-java-5.0.8-bin.jar
    --driver-class-path /path/to/mysql-connector-java-5.0.8-bin.jar
    --conf spark.executor.extraClassPath=/path/to/mysql-connector-java-5.0.8-bin.jar
    MY_APPLICATION.jar
  </code></pre>
  
  <p>but still get the "No suitable driver found for jdbc" error.</p>