I have been following official documentation following along with Activator Hello Slick 3.1, using MySQL instead of H2. With correct driver in dependency, slick can't find the driver class when running the test code. What could I be doing wrong here?
Here is my application.conf
mydb = {
driver = "com.mysql.cj.jdbc.Driver",
url = "jdbc:mysql://localhost:3306/hello_java?serverTimezone=UTC",
user = "nilu",
password = "password",
connectionPool = disabled
}
Here is code calling config (note the code is from Activator Hello Slick 3.1, I just replaced the driver component to connect to MySQL rather than h2:
import slick.driver.MySQLDriver.api._
object HelloSlick extends App {
val db = Database.forConfig("mydb")
....
Here is my build.sbt, as you can see, I have driver in dependency.
libraryDependencies ++= List(
"com.typesafe.slick" %% "slick" % "3.3.2",
"org.slf4j" % "slf4j-nop" % "1.7.10",
"mysql" % "mysql-connector-java" % "6.0.6",
)
I am getting following error:
Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver