title: Error writing Spark dataframe to postgres db
body: <p>I am trying to write out some metadata from my Spark jobs to a postgres db. Keep hitting the following error:</p>
  
  <pre><code>2018-03-13 15:23:40,599 root ERROR An error occurred while calling o1315.jdbc.
  : scala.MatchError: null
      at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:62)
      at org.apache.spark.sql.execution.datasources.DataSource.write(DataSource.scala:472)
      at org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand.run(SaveIntoDataSourceCommand.scala:48)
      at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:58)
      at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:56)
      at org.apache.spark.sql.execution.command.ExecutedCommandExec.doExecute(commands.scala:74)
      at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:117)
      at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:117)
      at org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:138)
      at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
      at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:135)
      at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:116)
      at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:92)
      at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:92)
      at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:610)
      at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:233)
      at org.apache.spark.sql.DataFrameWriter.jdbc(DataFrameWriter.scala:461)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
      at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
      at py4j.Gateway.invoke(Gateway.java:280)
      at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
      at py4j.commands.CallCommand.execute(CallCommand.java:79)
      at py4j.GatewayConnection.run(GatewayConnection.java:214)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>I'm supplying the following driver info in spark-conf.default:</p>
  
  <pre><code># Example:
  # spark.master                     spark://master:7077
  # spark.eventLog.enabled           true
  # spark.eventLog.dir               hdfs://namenode:8021/directory
  # spark.serializer                 org.apache.spark.serializer.KryoSerializer
  # spark.driver.memory              5g
  # spark.executor.extraJavaOptions  -XX:+PrintGCDetails -Dkey=value -Dnumbers="one two three"
  spark.driver.extraClassPath /path/to/drivers/postgresql-9.4.1210.jre7.jar
  spark.executor.extraClassPath /path/to/drivers/postgresql-9.4.1210.jre7.jar
  spark.jars /path/to/drivers/postgresql-9.4.1210.jre7.jar
  </code></pre>
  
  <p>Currently using Spark 2.2.0. Any idea what to check for?</p>