0

I have a db.conf which looks like this in the conf folder:

db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://62.210.145.112/babybets"
db.default.username=postgres
db.default.password="my_password"

It is included in the application.conf:

include "db.conf"

Infos are definitely correct, as I use this very same jdbc connection string, user/pass to connect the Intellij DB view to the database.

When I try to access any page, I get an error:

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.10-2.3.8.jar:2.3.8]
    at play.api.Configuration.reportError(Configuration.scala:743) ~[play_2.10-2.3.8.jar:2.3.8]
    at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:247) ~[play-jdbc_2.10-2.3.2.jar:2.3.2]
    at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:238) ~[play-jdbc_2.10-2.3.2.jar:2.3.2]
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library-2.10.5.jar:na]
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "John"
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:293) ~[postgresql-9.1-901-1.jdbc4.jar:na]
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:108) ~[postgresql-9.1-901-1.jdbc4.jar:na]
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) ~[postgresql-9.1-901-1.jdbc4.jar:na]
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125) ~[postgresql-9.1-901-1.jdbc4.jar:na]
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) ~[postgresql-9.1-901-1.jdbc4.jar:na]

In the above you can see it tries to connect to the database using my windows login "John".

I went through the project with agent Ransack and tried the following (case insensitive) regex:

[^\\]john[^\\]

It only matches with the above error log.

Question: Why is play using my windows login to Connect DB? How to prevent that ?

Just for info my build.sbt looks like this:

name := "babyBets2"

version := "1.0"

lazy val `babybets2` = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.10.5"

libraryDependencies ++= Seq( cache , ws )

libraryDependencies ++= Seq("postgresql" % "postgresql" % "9.1-901-1.jdbc4",
  "com.typesafe.play" %% "play-slick" % "0.8.0",
  "ws.securesocial" %% "securesocial" % "2.1.4" )

unmanagedResourceDirectories in Test <+=  baseDirectory ( _ /"target/web/public/test" )  
user2346536
  • 1,464
  • 2
  • 21
  • 43

1 Answers1

0

Ok this is crazy, there is a difference between Play versions:

https://www.playframework.com/documentation/2.4.x/ScalaDatabase https://www.playframework.com/documentation/2.3.x/ScalaDatabase

db.default.username=postgres

vs

db.default.user=postgres

So apparently, if no user is provided, play displays no useful error messages and tries to connect you with windows login!

user2346536
  • 1,464
  • 2
  • 21
  • 43