[Play 2.2.0 - Java] Postgres - Cannot connect to database

1,131 views
Skip to first unread message

Adam Margherio

unread,
Sep 22, 2013, 3:45:05 AM9/22/13
to play-fr...@googlegroups.com
Hey all,

I'm still relatively new to Play, and I've been fooling around with it on and off for the last month or so. I finally got around to my first serious bit of work with it, but I can't seem to get it to run locally. It's running over a Postgres 9.1.9 database. I added the dependency in the build.sbt file, configured the db.default values in the application.conf, and did a play dependencies to make sure I had the Postgres dependency downloaded. But whenever I do a play run from the terminal, it dies with the following error:

! @6fki7nbag - Internal server error, for (GET) [/] ->

play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:92) ~[play_2.10.jar:2.2.0]
at play.api.Configuration.reportError(Configuration.scala:570) ~[play_2.10.jar:2.2.0]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:252) ~[play-jdbc_2.10.jar:2.2.0]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:243) ~[play-jdbc_2.10.jar:2.2.0]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na]
Caused by: java.sql.SQLException: No suitable driver found for jdbc:postgres://localhost/nustyle
at java.sql.DriverManager.getConnection(DriverManager.java:596) ~[na:1.7.0_40]
at java.sql.DriverManager.getConnection(DriverManager.java:215) ~[na:1.7.0_40]
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:351) ~[bonecp.jar:na]
at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:405) ~[bonecp.jar:na]
at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:120) ~[bonecp.jar:na]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:245) ~[play-jdbc_2.10.jar:2.2.0]

The application.conf looks like:
# Postgres
# ~~~~~
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgres://localhost/testApp"
#db.default.user=thehelpinghand
#db.default.password=""

And the build.sbt looks like:
libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  "org.postgresql" % "postgresql" % "9.2-1003-jdbc4"
)

play.Project.playJavaSettings

Any suggestions? I'm not normally one to ask for help, but I've been searching for hours and haven't made any headway.

Johan Andren

unread,
Sep 22, 2013, 7:21:38 AM9/22/13
to play-fr...@googlegroups.com
I think it is because there is an error in your jdbc connection string: 

jdbc:postgres://localhost/testApp

should most likely be

jdbc:postgresql://localhost/testApp

Adam Margherio

unread,
Sep 22, 2013, 11:47:44 AM9/22/13
to play-fr...@googlegroups.com
That fixed it. I guess I got caught up looking after the ://. Thanks for the help!


--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/vzqemzTG1Tg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Adam Margherio
margher...@gmail.com (Email and Google Talk)
618-307-4355 (Google Voice)
Reply all
Reply to author
Forward
0 new messages