2

i am have problem while connecting to postgresql with playframework.

error is Driver not found: [org.postgresql.Driver]

we have added Code in application.conf:

db.default.url="postgres://localhost:root@secret/testdb"
db.default.driver=org.postgresql.Driver
db.default.user=""
db.default.password=""

code in Build.scala:

"postgresql" % "postgresql" % "9.1-902.jdbc4"

And we have placed postgresql-9.1-902.jdbc4.jar file in libraries folder

Could anyone has suggestions regarding this problem.

3 Answers 3

4

I don't think that is a valid version of the Postgres library. Try:

"postgresql" % "postgresql" % "9.1-901-1.jdbc4"

Then restart Play.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi james, thank you very much.. we are getting another problem regarding the line db.default.url="jdbc:postgresql://localhost/testdb" cannot connect to the database [default]
You should ask another question for that with details of the error message.
1

Do you have the PostgreSQL JDBC driver in your classpath ? See the final section of this document.

For example, if you use MySQL5, you need to add a dependency for the connector:

val appDependencies = Seq(
     // Add your project dependencies here,
     ...
     "mysql" % "mysql-connector-java" % "5.1.18"
     ...
)

2 Comments

Hi Brian,thank you for replying ... I have added the app dependencies in the build.scala file as you specified. but still i am getting same error.
@user1156917, Brian was giving an example. The exact line to be added in dependency is: "postgresql" % "postgresql" % "9.1-902.jdbc4"
0

You are most likely missing the jdbc driver.

Get the driver from http://jdbc.postgresql.org/download.html.
Place it in the lib/ directory in application folder.

4 Comments

Hi Bjarni, thanks for replying.. We have added the jar file. But i am still getting the same error
The driver version is correct, as long as you downloaded "postgresql-9.1-902.jdbc4.jar". Are you sure you placed the file in the "application/lib" folder?
The url changed in play 2 db.default.url="postgres://user:password@servername/dataBaseName"
we have the code: "postgres://a:a@localhost/testdb". but still we are getting the same problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.