Grails中如何访问两个数据库 [英] How do you access two databases in Grails

查看:16
本文介绍了Grails中如何访问两个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Grails 使得在其 DataSources.groovy 文件中为不同环境(开发、测试、生产)配置数据源变得非常容易,但似乎没有在一个环境中配置多个数据源的工具.如果我需要从同一个 Grails 应用程序访问多个数据库,我该怎么办?

Grails makes it very easy to configure datasources for different environments (development, test, production) in its DataSources.groovy file, but there seems to be no facility for configuring multiple datasources in one environment. What to I do if I need to access several databases from the same Grails application?

推荐答案

现在有了 Grails 插件,可以通过 Grails 的 GORM 层直接使用多个数据源:http://burtbeckwith.com/blog/?p=70

There is now Grails plugin that enables the use of multiple datasources directly with Grails' GORM layer: http://burtbeckwith.com/blog/?p=70

这篇关于Grails中如何访问两个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆