Skip to content

Instantly share code, notes, and snippets.

@dalegaspi
Last active October 9, 2019 16:17
Show Gist options
  • Save dalegaspi/dcbd597522e2637ddb51a685b37832f3 to your computer and use it in GitHub Desktop.
Save dalegaspi/dcbd597522e2637ddb51a685b37832f3 to your computer and use it in GitHub Desktop.
Using Postgesql with TypeSafe Slick 3.1.1
import slick.jdbc.PostgresProfile.api._
val sqldb = Database.forConfig("yomama.postgres")
// profit!
# Typesafe's documentation is wrong, every StackOverflow answer as of 08/31/2016 is no longer valid
# this is how you set your application.conf
# JDBC setting
yomama {
postgres {
dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
properties {
#driver = "slick.driver.PostgresDriver$"
driver ="org.postgresql.Driver"
url = "postgres://POSTGRES_SERVER:POSTGRES_PORT/POSTGRES_DB"
user = "USERNAME"
password = "PASSWORD"
}
}
}
// for use with your build.sbt
object Dependencies {
// ... all your other dependencies
val typesafeSlick = "com.typesafe.slick" %% "slick" % "3.1.1"
val postgreSql = "org.postgresql" % "postgresql" % "9.4.1209"
val hikariCP = "com.typesafe.slick" %% "slick-hikaricp" % "3.1.0" // you need really need this or you get ClassNotFoundException
}
@km3ll
Copy link

km3ll commented Feb 4, 2019

Thanks @sergigp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment