2

I'm new to Play framework. I'm trying to configure MySQL database as a datasource to be used with Play.

i have done following setting to connect mysql database to play..

db.default.driver=com.mysql.jdbc.Driver

db.default.url="jdbc:mysql://localhost/phpmyadmin/index.php?db=formdemo&token=3882f545563c7df106e1daf21515e1b7#PMAURL:db=formdemo&server=1&target=db_structure.php&token=3882f545563c7df106e1daf21515e1b7"


but i am getting following configuration error.

play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]


I am not able to connect my wamp localhost database to play. How do I modify the configuration file to use a mysql database as opposed to an in-memory version. Do I need to setup an entirely separate DB or can I modify the db.default.url property?

I'm using Play! 2.1.

Community
  • 1
  • 1
  • 1
    This might help: http://stackoverflow.com/questions/10007029/steps-needed-to-use-mysql-database-with-play-framework-2-0/10007131#10007131 It looks like you want to point to phpmyadmin somehow. Why is that? – Carsten May 03 '13 at 09:54

2 Answers2

2

I have resolved with issue. Thank You for your guidance.

Few lines to Put. dependency

"mysql" % "mysql-connector-java" % "5.1.18" 

Conf

db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://localhost/FORMDEMO?characterEncoding=UTF-8"
db.default.user=root
db.default.password=""

Follow the reference, http://blog.knoldus.com/2013/01/28/play-framework-2-0-connectivity-with-mysql-in-scala/

1

Your url should be in this structure:

db.default.driver=com.mysql.jdbc.Driver
db.default.url="mysql://username:password@localhost/formdemo"

If you didn't set the default password, it is usually root with no password, like this:

db.default.url="mysql://username:@localhost/formdemo"
singhakash
  • 7,891
  • 6
  • 31
  • 65
Rebecca Grenier
  • 171
  • 1
  • 5