首页 > 代码库 > play2使用非默认数据库

play2使用非默认数据库

1.application.conf中配置数据库

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

 db.default.url="mysql://root:secret@localhost/myDatabase"

2.添加依赖
val appDependencies = Seq(    // Add your project dependencies here,    ...    "mysql" % "mysql-connector-java" % "5.1.18"    ...)