【发布时间】:2012-06-23 06:49:30
【问题描述】:
我怎样才能在 Grails 2.0.4 中做这样的事情?
dataSource {
dbCreate = "create-drop"
String host = request.getServerName()
switch( host ) {
case "company1.com": url = "jdbc:mysql://localhost/db1"
case "company2.com": url = "jdbc:mysql://localhost/db2"
default: null
}
}
我不想使用多租户核心插件
【问题讨论】:
-
嗯,成功了吗?如果没有,为什么不呢?
-
我不认为你可以在运行时以这种方式连接到任意数据库。你的闭包也不会被每个传入的请求调用。
标签: database grails datasource