6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PlayFramework(Java)Advent Calendar 2016

Day 8

Playframeworkで複数のDBに接続する

Last updated at Posted at 2016-12-08

カレンダーがなかな充実しないので、小ネタを。。。
今回はメモ的な感覚で。。。

設計上DBを2つに分けてたいと思って、まさかなと思って試したら案の定できたので残しておく

application.conf
db {
# 1つ目のDB設定
  main.driver = org.mariadb.jdbc.Driver
  main.url = "jdbc:mariadb://localhost:3306/MAIN_DB_NAME"
  main.username = USER_NAME
  main.password = PASSWORD

# 2つ目のDB設定
  sub.driver = org.mariadb.jdbc.Driver
  sub.url = "jdbc:mariadb://localhost:3306/SUB_DB_NAME"
  sub.username = USER_NAME
  sub.password = PASSWORD

}
ebean {
  main = ["models.entity.main.*"]
  sub = ["models.entity.sub.*"]
}

~~~

考えればわかることでしたね。。。



6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?