在grails中不能使用progresql [英] Can't use progresql in grails

查看:237
本文介绍了在grails中不能使用progresql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



一切正常,但系统可以使用postgresql,尽管我在datasource.config中设置了它。我的datasource.config类似于旧的真正的,只是改变了远程服务器和本地服务器之间的东西。这是我的datasource.config。

$ h $ {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class ='net.sf.ehcache.hibernate.EhCacheRegionFactory'

}

//环境特定设置
环境{
生产{
汇集= TRUE
driverClassName = org.postgresql.Driver
的用户名= Postgres的
密码= Postgres的
dbCreate的= create-drop//创建一个'create-drop','update','validate'
url =jdbc:postgresql:// localhost:5432 / faql_dev
}
}

这是我得到的一些错误:

 原因:org.compass.gps.device.hibernate.HibernateGpsDeviceException:{hibernate}:无法索引数据库;嵌套的例外是org.hibernate.exception.SQLGrammarException:使用滚动
在org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:172)
。在组织无法执行查询.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor $ 1 $ 1.doInCompassWithoutResult(ConcurrentParallelIndexExecutor.java:104)
。在org.compass.core.CompassCallbackWithoutResult.doInCompass(CompassCallbackWithoutResult.java:29)
。在有机.compass.core.CompassTemplate.execute(CompassTemplate.java:133)
在org.compass.gps.impl.SingleCompassGps.executeForIndex(SingleCompassGps.java:147)
在org.compass.gps.device org.hibernate.exception.SQLGrammarException:.support.parallel.ConcurrentParallelIndexExecutor $ 1.call(ConcurrentParallelIndexExecutor.java:102)
... 5个
所致使用滚动
无法执行查询在org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitie sIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:118)
... 10个
引起的:org.h2.jdbc.JdbcSQLException:表 问题 没有找到; SQL语句:

我将一切都涉及到postgresql,所以我可以在开发模式下基于域创建表,但我无法运行它。在生产中,它会抛出这个异常。



预先感谢! 解决方案

 造成者:org.h2.jdbc.JdbcSQLException 

这表明你正在使用错误的JDBC驱动程序。您发布的数据源配置只会在 production 模式下将应用设置为使用Postgres,如果您在dev模式下以本地方式运行,那么它将使用默认的H2数据库。


I'm importing a exists grails project, this project use postgresql use remote postgresql, they built it on real machine, now I need do it on my localhost machine, and use postgresql local.

Everything is OK, but the system can use postgresql, althought I set up it in datasource.config. My datasource.config is similar to old real one, just change something between remote server and local server. Here is my 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"
    }
}

Here is some error I got:

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:

I imported everything involve to postgresql, So I can create table based on domain in development mode, but I can't run it. In production, it will throw that exception.

Thanks in advance!

解决方案

Caused by: org.h2.jdbc.JdbcSQLException

This suggests to me that you're using the wrong JDBC driver. The data source configuration you've posted only sets the app up to use Postgres in production mode, if you run locally in dev mode then it'll use the default H2 database.

这篇关于在grails中不能使用progresql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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