title: Hive with Spark and MySQL metadatastore
body: <p>I'm trying to configure Apache Spark with Hive and a MySQL backed metadatastore.  I am getting the following exception</p>
  
  <pre><code>Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://&lt;correct-information&gt;
  </code></pre>
  
  <p>I was able to start spark-shell with the following command</p>
  
  <pre><code>bin/spark-shell --jars /usr/share/java/mysql-connector-java.jar
  </code></pre>
  
  <p>and then then I ran the following commands</p>
  
  <pre><code>scala&gt; Class.forName("com.mysql.jdbc.Driver")
  res0: Class[_] = class com.mysql.jdbc.Driver
  
  scala&gt; new org.apache.spark.sql.hive.HiveContext(sc).sql("select * from table limit 1").first
  </code></pre>
  
  <p>The exceptions I get are huge, but here is the very top</p>
  
  <pre><code>Unable to open a test connection to the given database. JDBC url = jdbc:mysql://&lt;hostname&gt;/metastore, username = hiveuser. Terminating connection pool. Original Exception: ------
  java.sql.SQLException: No suitable driver found for jdbc:mysql://&lt;hostname&gt;/metastore
  </code></pre>
  
  <p>This very simple query runs fine from the hive command line.  The first spark command shows that the mysql JDBC driver is on the classpath, but it still can't seem to find it.  Does anyone have any ideas?</p>
  
  <p>Thanks</p>