Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql with Play Framework

Im trying to use Postgresql with Play for their Yabe tutorial and get this error:

Cannot connected to the database, Driver not found (org.postgresql.Driver)

Here is my connection string:

# If you need a full JDBC configuration use the following :
 db.url=jdbc:postgresql:yabe
 db.driver=org.postgresql.Driver  
 db.user=yabe
 db.pass=yabe
#
# Connections pool configuration :
 db.pool.timeout=1000
 db.pool.maxSize=30
 db.pool.minSize=1

In my lib folder I have this: postgresql-9.1-901.jdbc3.jar

I tried changing the driver name to the same name is tha jar but still get the same error. Any ideas?

like image 646
Todd Avatar asked Oct 11 '11 20:10

Todd


2 Answers

If you are using Play 2.0 this works slightly differently. The url actually looks like this:

db.default.driver=org.postgresql.Driver
db.default.url="postgres://user:password@servername/dataBaseName"

But this will also error out unless you add the following lines to you dependencies section in build.scala or build.java:

"postgresql" % "postgresql" % "9.1-901.jdbc4"
like image 72
Anthony Skipper Avatar answered Sep 20 '22 16:09

Anthony Skipper


If you need SSL support:

db=postgres://user:[email protected]:5432/dbname?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
like image 25
reen Avatar answered Sep 20 '22 16:09

reen