postgresql - 如何使用 Postgresql 设置 Play Slick

标签 postgresql scala playframework slick

我是第一次尝试设置 Play 项目,但我已经卡住了! 事实上,当我运行应用程序时,只要我尝试调用“http://localhost:9000/”,就会得到这个异常:

java.sql.SQLTransientConnectionException: db - Connection is not available, request timed out after 1004ms

我也每 2 秒在日志中记录一次:

[error] c.z.h.p.PoolBase - db - Failed to execute isValid() for connection, configure connection test query. (Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.)

这就是我所做的:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

代码端我刚刚创建了一个类 DAO 来添加、删除和列出用户表的记录,并从 Controller 调用了“添加”方法。

我希望我提供了足够的细节

最佳答案

我找到了使用 Play Slick 库的最终解决方案,并以这种方式配置它:

enter image description here

enter image description here

enter image description here

您可以从 this page 中的表格中查看 PlaySlick 库中使用的 Slick 和 Play 版本

关于postgresql - 如何使用 Postgresql 设置 Play Slick,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48628893/

相关文章:

postgresql - 使多个用户访问 PSQL 数据库

java - 斯卡拉/ jack 森 : how to deserialize into generic type

scala - scala.collection.Set [scala.Predef.String]类型的表达式与预期的scala.Predef.Set [scala.Predef.String]类型不符

java - PlayFramework [NullPointerException : null] when add an item in ArrayList or HashMap

xml - 发布 DTD/XXE XML 时测试 Scala Play 行为

postgresql - PGError : ERROR: operator does not exist: boolean ~~* unknown

PostgreSQL 使用 Levenshtein 模糊搜索多个单词

postgresql - 数据库连接自动关闭

java - java中的范围锁

java - 如何在 Play 中的多个应用程序之间共享模型!框架?