Matteo Pacini
Matteo Pacini

Reputation: 22846

Scala and MySQL JDBC Driver

I'm currently working on a SBT-based Scala project and I need to use MySQL as database (through Slick 3.0.0 library).

The issue is that I can't connect to the database because of this exception:

> service[ERROR] java.sql.SQLException: No suitable driver
service[ERROR]  at java.sql.DriverManager.getDriver(DriverManager.java:315)
service[ERROR]  at slick.jdbc.DriverBasedJdbcDataSource$class.registerDriver(JdbcDataSource.scala:60)
service[ERROR]  at slick.jdbc.DriverJdbcDataSource.registerDriver(JdbcDataSource.scala:72)
service[ERROR]  at slick.jdbc.DriverJdbcDataSource.<init>(JdbcDataSource.scala:78)
service[ERROR]  at slick.jdbc.JdbcBackend$DatabaseFactoryDef$class.forURL(JdbcBackend.scala:101)
service[ERROR]  at slick.jdbc.JdbcBackend$$anon$3.forURL(JdbcBackend.scala:33)

enter image description here

What I've done so far (see screenshot):

Any idea on how to solve this?

Thanks.

Upvotes: 1

Views: 2196

Answers (1)

mohit
mohit

Reputation: 4999

It should be jdbc:mysql://localhost:3306/service not jdbc:mysql/localhost:3306/service. You are missing a slash and colon after mysql.

Tried on my own project. The error with the wrong jdbc URL gives me same exception as yours. I guess this exception is misleading.

Upvotes: 1

Related Questions