我正在尝试使用play框架连接到mysql。我是新手,无法找出确切的问题。任何帮助将受到高度赞赏。
conf\application.conf
中的配置如下:
config = "db"
default = "default"
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://localhost/ng_play"
db.default.username=root
db.default.password="****"
ebean.default = ["models.*"]
build.sbt
name := """play-scala-tutorial-one"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
jdbc,
cache,
ws,
"mysql" % "mysql-connector-java" % "5.1.36",
"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % Test
)
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
答案 0 :(得分:0)
Mysql版本和数据库连接器版本不匹配。并且将此db.default.hikaricp.connectionTestQuery="SELECT TRUE"
添加到application.conf
有助于缓解一个问题。
感谢@silentprogrammer和@salem寻求帮助。