mysql - Access more than one db with ScalaAnorm with Play -
how access 2 separate mysql databases scalaanorm?
the documentation seems provide examples single db access.
you give second db name (instead of default
) in application.conf
it's own settings:
db.default.driver=com.mysql.jdbc.driver db.default.url= ... db.default.user= ... db.default.password= ... db.anotherdb.driver=com.mysql.jdbc.driver db.anotherdb.url= ... db.anotherdb.user= ... db.anotherdb.password= ...
then can specify database want use so:
db.withconnnection("default") { implicit connection => // uses database named "default" } db.withconnnection("anotherdb") { implicit connection => // uses database named "anotherdb" }
Comments
Post a Comment