不能在grails中使用progresql

时间:2013-08-06 08:43:59

标签: grails gorm grails-domain-class

我正在导入一个存在的grails项目,这个项目使用postgresql使用远程postgresql,他们在真机上构建它,现在我需要在我的localhost机器上执行它,并使用postgresql local。

一切都很好,但是系统可以使用postgresql,虽然我在datasource.config中设置了它。我的datasource.config类似于旧的,只是在远程服务器和本地服务器之间进行更改。这是我的datasource.config。

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 {
    production {
    pooled = true
    driverClassName = "org.postgresql.Driver"
    username = "postgres"
    password = "postgres"
    dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate'
    url = "jdbc:postgresql://localhost:5432/faql_dev"
    }
}

这是我得到的一些错误:

Caused by: org.compass.gps.device.hibernate.HibernateGpsDeviceException: {hibernate}: Failed to index the database; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query using scroll
at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:172)
at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1$1.doInCompassWithoutResult(ConcurrentParallelIndexExecutor.java:104)
at org.compass.core.CompassCallbackWithoutResult.doInCompass(CompassCallbackWithoutResult.java:29)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:133)
at org.compass.gps.impl.SingleCompassGps.executeForIndex(SingleCompassGps.java:147)
at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1.call(ConcurrentParallelIndexExecutor.java:102)
... 5 more
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query using scroll
    at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:118)
    ... 10 more
Caused by: org.h2.jdbc.JdbcSQLException: Table "QUESTION" not found; SQL statement:

我导入的所有内容都涉及到postgresql,所以我可以在开发模式下创建基于域的表,但我无法运行它。在生产中,它将抛出异常。

提前致谢!

1 个答案:

答案 0 :(得分:2)

Caused by: org.h2.jdbc.JdbcSQLException

这告诉我你使用了错误的JDBC驱动程序。您发布的数据源配置仅将应用程序设置为在生产模式下使用Postgres,如果您在开发模式下本地运行,那么它将使用默认的H2数据库。