首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

Grails配备外部数据库

2012-11-10 
Grails配置外部数据库在Grails项目中的conf文件夹下如图打开DataSource文件作如下配置这里链接的是mysql数

Grails配置外部数据库

在Grails项目中的conf文件夹下如图

Grails配备外部数据库

打开DataSource文件作如下配置这里链接的是mysql数据库dataSource {//连接池打开??? pooled = true//驱动名字??? driverClassName = “com.mysql.jdbc.Driver”//用户名??? username = “root”//密码password = “root”//数据库方言??? dialect = org.hibernate.dialect.MySQL5InnoDBDialect}hibernate {??? cache.use_second_level_cache = true??? cache.use_query_cache = true??? cache.provider_class = ‘net.sf.ehcache.hibernate.EhCacheProvider’}// 不同的模式environments {//开始模式??? development {??????? dataSource {??????????? dbCreate = “update” // one of ‘create’, ‘create-drop’,'update’??????????? url = “jdbc:mysql://localhost:3306/gralis?useUnicode=true&characterEncoding=UTF-8″??????? }??? }//测试模式??? test {??????? dataSource {???????????? dbCreate = “update” // one of ‘create’, ‘create-drop’,'update’??????????? url = “jdbc:mysql://localhost:3306/gralis?useUnicode=true&characterEncoding=UTF-8″??????? }??? }//发布模式??? production {??????? dataSource {??????????? dbCreate = “update” // one of ‘create’, ‘create-drop’,'update’??????????? url = “jdbc:mysql://localhost:3306/gralis?useUnicode=true&characterEncoding=UTF-8″??????? }??? }}

同时在lib文件夹下添加mysql驱动包

?

?

热点排行