JDBC is an API for connecting to SQL databases in Java. It remains the simplest way of connecting to SQL databases from Scala. Furthermore, the majority of higher-level abstractions for interacting with databases still use JDBC as a backend.
JDBC is not a library in itself. Rather, it exposes a set of interfaces to interact with databases. Relational database vendors then provide specific implementations of these interfaces.
Let's start by creating a build.sbt
file. We will declare a dependency on the MySQL JDBC connector:
scalaVersion := "2.11.7" libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.36"