用 play 安装 postgresql!框架(未找到驱动程序:[org.postgresql.Driver])
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24124789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install postgresql with play! framework (Driver not found: [org.postgresql.Driver])
提问by Simon
I'm new with the play! framework and postgresql and I'm trying to make it work.
我是新来的!框架和 postgresql,我正在努力让它工作。
I read a lot of questions asked on stackoverflow and I searched a lot on google but I didn't manage to make it work.
我阅读了很多关于 stackoverflow 的问题,我在谷歌上搜索了很多,但我没有设法让它工作。
Here is the error that Play! gives me :
这是播放错误!给我 :
Driver not found: [org.postgresql.Driver]
My questions are :
我的问题是:
1) Do you know an easy tutorial (i.e. that explains from the beginning) that shows how to configure play! to make postgresql work? I read a lot of thing but didn't find a detailed tutorial.
1)你知道一个简单的教程(即从头开始解释),展示如何配置播放!使postgresql 工作?我读了很多东西,但没有找到详细的教程。
2) If not, here is my configuration :
2)如果没有,这是我的配置:
I added this in application.conf
:
我在application.conf
:
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://127.0.0.1/postgres"
db.default.user=postgres
db.default.password=root
And in built.sbt
:
并在built.sbt
:
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
)
What am I doing wrong?
我究竟做错了什么?
回答by Ryan
As the documenation says, you have to add the driver to your dependencies:
正如文档所说,您必须将驱动程序添加到您的依赖项中:
libraryDependencies += "org.postgresql" % "postgresql" % "42.2.12"
Use the appropriate version of the driver for your Postgres installation.
为您的 Postgres 安装使用适当版本的驱动程序。
http://www.playframework.com/documentation/2.3.x/ScalaDatabase
http://www.playframework.com/documentation/2.3.x/ScalaDatabase