So what should I do next? An it would be great if some one could guide me in connecting MySQL with play.
You need to add the proper dependency. Since you are using Java, you need to add the following one:
libraryDependencies += javaJdbc
See more details about the dependency here:
http://mvnrepository.com/artifact/com.typesafe.play/play-java-jdbc_2.12/2.6.11
You can try the following: Add the below code in build.sbt
libraryDependencies ++= Seq(javaJdbc)
libraryDependencies += "mysql" % "mysql-connector-java" % "8.0.8-dmr"
libraryDependencies += evolutions
And then in your plugins.sbt if you are using Ebean then
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "4.0.3")
else, other Java Persistence framework.
Then make sure in your application.conf you have the following entries:
play.evolutions {
db.default.enabled = false
}
db{
default.driver=com.mysql.cj.jdbc.Driver
default.url="jdbc:mysql://localhost/db_name?useSSL=false"
default.username="u_name"
default.password="u_pass"
}
play.db{
hikaricp.minimumIdle = 50
hikaricp.maximumPoolSize = 50
}
ebean.default = ["models.*"]
Finally do make a schema using MySQL workbench (considering you are using MySQL) in your db to access it from within your application
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.