Skip to content

JDBC Data Source

Spark SQL supports loading data from tables using JDBC.

Spark developers use DataFrameReader.jdbc to load data from an external table using JDBC.

val table = spark.read.jdbc(url, table, properties)

// Alternatively
val table = spark.read.format("jdbc").options(...).load(...)

These one-liners create a DataFrame that represents the distributed process of loading data from a database and a table (with additional properties).

Back to top