I just started working with Play Framework in Scala for a school project so I don't know much about the the Framework yet. I'm trying to connect my project to PostgreSql using slick but it is not working. I did exactly the same I have found in the Play website and in many tutorials but it doesn't work.
This is my DB config in the application.conf file
slick.dbs.default.driver="slick.driver.PostgresDriver$"
slick.dbs.default.db.driver="org.postgresql.Driver"
slick.dbs.default.db.url="jdbc:postgresql://localhost:5432/IRProject"
slick.dbs.default.db.user="<my_username>"
slick.dbs.default.db.password="<my_password>"
1.sql file in conf/evolutions/default
# --- !Ups
CREATE TABLE Document(
id SERIAL PRIMARY KEY NOT NULL,
title VARCHAR(500),
date TIMESTAMP WITH TIME ZONE,
url VARCHAR(1000) NOT NULL ,
path VARCHAR(1000) NOT NULL ,
summary VARCHAR(5000) NOT NULL
);
# --- !Downs
DROP TABLE IF EXISTS Document;
My dependencies:
"org.webjars" % "jquery" % "2.1.3",
"com.typesafe.play" %% "play-slick" % "1.1.1",
"com.typesafe.play" %% "play-slick-evolutions" % "1.1.1",
"postgresql" % "postgresql" % "9.1-901.jdbc4"
When I run using activator, I don't see any logs about DB connection or any error at all. The application just starts up but without any tables in the database.
Does any one know a reason for this?
Should anyone come across this problem, these are the solutions I found.
I needed to add a test query that can be used to test the connection e.g
slick.dbs.default.db.connectionTestQuery="SELECT TRUE"
After this it worked.