I'm new to Play framework. I'm trying to configure MySQL database as a datasource to be used with Play Ebeans.
Could you some one please explain the steps that are needed to configure MySQL with Play 2.0 framework (like, downloading drivers, adding dependency etc).
Got stuck with my MySQL configuration until I found this.
Most important things taken from @biesior answer:
/project/Build.scala
)play dependencies
to resolve newly added MySQL connector/J dependencyebean.default="models.*"
db.default.driver=com.mysql.jdbc.Driver db.default.url="jdbc:mysql://www.sample.com:3306/test?characterEncoding=UTF-8" db.default.user=playuser db.default.pass=playuser
It saved my day.
Play 2.4.3 & MYSQL 5.7.9
I was able to get this working by piecing together bits of info from all the previous answers. So here is another one, that is hopefully more up to date or useful to those with a similar environment.
Environment Details: (this is what I am using)
appication.conf
Note:
3306
in the example because that is usually the default for MYSQL.build.sbt
Add this line below to your build.sbt file. This should go after the
libraryDependencies ++= Seq()
declaration.Finally
activator reload
I had the same issue in latest play framework 2.4.x with activator 1.3.6.
Here are the steps. I Followed the steps described here https://www.playframework.com/documentation/2.4.x/JavaDatabase
Here is my
application.conf
Here is
build.sbt
plugins.sbt
Here is the important step.
I am using play 2.2.0 and I just had to add the following line to build.sbt in project's root folder.
And play automatically downloads the driver. It seems Build.scala is not needed for this anymore. Changes to application.conf should be applied as the above commentators have mentioned.