Grails数据库不存在

时间:2014-02-07 12:16:26

标签: mysql grails

Grails数据库在服务器重启后不会保留,在我的数据源文件中我有以下代码。 请检查我失踪的地方。

修改

   dataSource {
   pooled = true
   driverClassName = "com.mysql.jdbc.Driver"
   username = "admin"
   password = "admin"
  }
 hibernate {
      cache.use_second_level_cache = true
      cache.use_query_cache = false
      cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
  }
 // environment specific settings
   environments {
      development {
           dataSource {
           dbCreate = "update"
        url = "jdbc:mysql://localhost/mydb?useUnicode=yes&characterEncoding=UTF-      8&zeroDateTimeBehavior=convertToNull"
        pooled = true
        properties {
           maxActive = -1
           minEvictableIdleTimeMillis=1800000
           timeBetweenEvictionRunsMillis=1800000
           numTestsPerEvictionRun=3
           testOnBorrow=true
           testWhileIdle=true
           testOnReturn=true
           validationQuery="SELECT 1"
        }
    }
    hibernate {
        show_sql = false
     }
               }
          test {
        dataSource {
            dbCreate = "update"
            url = "jdbc:mysql://localhost/mydb?useUnicode=yes&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull"
        pooled = true
        properties {
           maxActive = -1
           minEvictableIdleTimeMillis=1800000
           timeBetweenEvictionRunsMillis=1800000
           numTestsPerEvictionRun=3
           testOnBorrow=true
           testWhileIdle=true
           testOnReturn=true
           validationQuery="SELECT 1"
        }
    }
    hibernate {
        show_sql = false
    }
}
production {
    dataSource {
        dbCreate = "update"
        url = "jdbc:mysql://localhost/mydb?useUnicode=yes&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull"
        pooled = true
        properties {
           maxActive = -1
           minEvictableIdleTimeMillis=1800000
           timeBetweenEvictionRunsMillis=1800000
           numTestsPerEvictionRun=3
           testOnBorrow=true
           testWhileIdle=true
           testOnReturn=true
           validationQuery="SELECT 1"
        }
    }
}
}

但是当我重新启动服务器时,洞数据库就会丢失。请给我一个建议。

提前致谢。

0 个答案:

没有答案