Fraska Portal

Exploring the WebSphere Commerce world

JEE, Play Framework and mySQL integration

Posted by on in Play Framework
  • Font size: Larger Smaller
  • Hits: 2175
  • 11 Comments
  • Subscribe to this entry
  • Print

In the posts I found browsing around I could not get the exact working configuration for my environment, so I think it can help someone out review the configuration steps I made to integrated MySQL db with Play!.

Environment:

  • Mac OS X 10.7.5
  • MySQL 5.1.44
  • Eclipse 4.2 Juno
  • JVM 1.6.0_43
  • Play! 2.1.0

1) Add MySQL connector dependency

Open the file <project name>/project/Build.scala and add the MySQL connector dependency like in the following code:

val appDependencies = Seq(
    // Add your project dependencies here,
    javaCore,
    javaJdbc,
    javaEbean,
     "mysql" % "mysql-connector-java" % "5.1.18"
  ) 

 2) Let Play updates the dependencies

In order to make Play aware of the new dependency and get the connector code stated previously, it's necessary run the dependency update job in the Play console, with the command dependencies:

Play Framework Console, update dependecies

3) Configure DB connection

Open the file <project name>/conf/application.conf and set the DB connection coordinates, for example:

db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://localhost:3306/<dbname>"
db.default.user="root"
db.default.password=""

 

4) Enable use of ebean

In the same configuration file- <project name>/conf/application.conf- uncomment the following line: 

ebean.default="models.*"

 

The app should work now, ... good luck!

Rate this blog entry:
0

Comments

Leave your comment

Guest
Guest Tuesday, 22 October 2019

Most Popular Post

WebSphere Commerce, the curious life of a front-end catalog request
Core
Rate this blog entry:
5
WebSphere Commerce, the SOLR extension index
Administration
Rate this blog entry:
4
WebSphere Commerce, Data Load and SOLR Delta Index
Data Load
Rate this blog entry:
0

Latest Blogs

WebSphere Commerce, CommandLevelAuthorizationCache
Cache
Rate this blog entry:
0
WebSphere Commerce v8, toolkit exception, ClassNotFound db2
Administration
Rate this blog entry:
1
WebSphere Commerce, ATP migration
Store
Rate this blog entry:
0
WebSphere Commerce, the curious life of a front-end catalog request
Core
Rate this blog entry:
5
WebSphere Commerce, Performance analysis of few European stores
Performance
Rate this blog entry:
0