Esardes Esardes - 1 year ago 81
SQL Question

Scala/Slick JDBC encoding configuration with typesafe config

I am building a Scala application using Slick where I load my

val db = Database.forConfig("")
and where my "application.conf" file looks like

mysql = {
dev = {
dataSourceClass = "com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
properties = {
databaseName = "test"
user = "user"
password = "password"
serverName = "localhost"

I am successfully saving data to my database which uses a default utf-8 encoding. However when trying to save the character 泗 I ended in my database with the dreaded
instead of input character.

I think I failed to declare that my connection needs to use UTF-8, however I couldn't find the option in the documentation of

Do you know how I can fix that?

Answer Source

For MySQL, adding parameters useUnicode=true&characterEncoding=UTF-8 in your connection URL should solve the issue ie.


You could use this link to configure url.