The JDBC API is the Java™ SE standard for database-independent connectivity between the Java™ programming language and a wide range of databases: SQL or NoSQL databases and tabular data sources like spreadsheets or flat files.
JDBC Data Source
Spark SQL supports loading data from tables using JDBC.
As a Spark developer, you 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).