Playframework 2.5.0 and slick Log SQL Statements/Queries

In playframework 2.5.x in your logback.xml file add the following line.

<logger name="slick.jdbc.JdbcBackend.statement" level="DEBUG" />

Playframework 2.5. correct postgres configuration

In application.conf at the end of the file do:

slick.dbs.default.driver = "slick.driver.PostgresDriver$"
slick.dbs.default.db.driver = "org.postgresql.Driver"
slick.dbs.default.db.url = "jdbc:postgresql://localhost:5432/database"
slick.dbs.default.db.user = "username"
slick.dbs.default.db.password = "password"

Scala Playframework connect to mysql

I’m writting this because I had issues following the documentation that comes with playframework
the docs are wrong or at least for me it gave me an error.

The docs states that to connect to a mysql database server you have to do the following:

If you need to connect to another JDBC-compliant database, first add the corresponding driver library to your application dependencies in build.sbt e.g.:

libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.18"

This above works ok, I had no problems.

Then add the corresponding JDBC configuration to the conf/application.conf file:

db.url=jdbc:mysql:database_name
db.driver=org.mysql.Driver
db.user=root
db.pass=secret

This above now has problems namely the db.driver section it returned me an error
java.lang.ClassNotFoundException: org.mysql.Driver

Searching the internet I found this answer

http://solvedstack.com/questions/steps-needed-to-use-mysql-database-with-play-framework-2-0

So the correct working version is:

db.default.driver=com.mysql.jdbc.Driver
db.default.user=root
db.default.pass=secret

db.default.url=”jdbc:mysql://localhost/database_name?characterEncoding=UTF-8″

Maybe for others this is easy to spot but for me it wasn’t.