我想用 anorm 和 Magic[T] 访问 Play Scala 中的两个数据库(一个是 H2,另一个是 PostgreSQL)。就是不知道怎么配置。。。
我注意到我们可以在 conf/application.conf 中设置另一个数据库连接
db_other.url=jdbc:mysql://localhost/test
db_other.driver=com.mysql.jdbc.Driver
db_other.user=root
db_other.pass=
但是,我如何将它与 Magic 一起使用?(我看了Magic的源代码但是看不懂……我是Scala的大一新生)
无论如何,如果使用 Magic[T] 无法访问多个数据库,我希望使用 anorm 来完成,那么我该如何配置呢?
var sqlQuery = SQL( //I guess some config params should be set here, but how?
"""
select * from Country
"""
)