Skip to content
Snippets Groups Projects
Commit e5949c28 authored by Michael Armbrust's avatar Michael Armbrust
Browse files

[SPARK-6966][SQL] Use correct ClassLoader for JDBC Driver

Otherwise we cannot add jars with drivers after the fact.

Author: Michael Armbrust <michael@databricks.com>

Closes #5543 from marmbrus/jdbcClassloader and squashes the following commits:

d9930f3 [Michael Armbrust] fix imports
73d0614 [Michael Armbrust] [SPARK-6966][SQL] Use correct ClassLoader for JDBC Driver
parent 1e43851d
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ import org.apache.spark.sql.SQLContext
import org.apache.spark.sql.catalyst.expressions.Row
import org.apache.spark.sql.sources._
import org.apache.spark.sql.types.StructType
import org.apache.spark.util.Utils
/**
* Data corresponding to one partition of a JDBCRDD.
......@@ -99,7 +100,7 @@ private[sql] class DefaultSource extends RelationProvider {
val upperBound = parameters.getOrElse("upperBound", null)
val numPartitions = parameters.getOrElse("numPartitions", null)
if (driver != null) Class.forName(driver)
if (driver != null) Utils.getContextOrSparkClassLoader.loadClass(driver)
if (partitionColumn != null
&& (lowerBound == null || upperBound == null || numPartitions == null)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment