I have just started working on play framework. I am trying to build rest api, and is using postgresql for my db connection. It is my first time using both play and postgre. I have made a db connection inside build.sbt. But while running the app I am getting the following issue,
play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94) ~[play_2.11-2.3.6.jar:2.3.6]
at play.api.Configuration.reportError(Configuration.scala:743) ~[play_2.11-2.3.6.jar:2.3.6]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:247) ~[play-jdbc_2.11-2.3.6.jar:2.3.6]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:238) ~[play-jdbc_2.11-2.3.6.jar:2.3.6]
at scala.collection.immutable.List.map(List.scala:274) ~[scala-library-2.11.1.jar:na]
Caused by: org.postgresql.util.PSQLException: FATAL: database "localhost:5432/sampledb" does not exist
at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:572) ~[postgresql-9.3-1100-jdbc41.jar:na]
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:177) ~[postgresql-9.3-1100-jdbc41.jar:na]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) ~[postgresql-9.3-1100-jdbc41.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136) ~[postgresql-9.3-1100-jdbc41.jar:na]
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29) ~[postgresql-9.3-1100-jdbc41.jar:na]
I have postgre installed in my local in port 5432, my db configuration in application.conf looks like -
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql:localhost:5432/sampledb"
db.default.user=postgres
db.default.password="test"
Any help will be highly appreciated, also I will be really grateful, if link to any good tutorial on play with java can be provided. Thanks.