Thread: Problems using Grails with Postgresql

Problems using Grails with Postgresql

From
priyaa
Date:
i am using postgresql instead of mysql ,but while execute i am getting error
like


Caused by: org.codehaus.groovy.runtime.InvokerInvocationException:
org.springframework.dao.InvalidDataAccessResourceUsageException: could not
execute query; nested exception is
org.hibernate.exception.SQLGrammarException: could not execute query


my codings in datasource:


dataSource {
    pooled = false

     driverClassName = "org.postgresql.Driver"
    username ="sa"
    password =""
}
hibernate {
    cache.use_second_level_cache=true
    cache.use_query_cache=true

cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider'

}
// environment specific settings
environments {
    development {
        dataSource {

            dbCreate = "update" // one of 'create', 'create-drop','update'
                  url ="jdbc:postgresql://localhost:5432/test"
        }
    }
    test {
        dataSource {
            dbCreate = "update"
            url = "jdbc:hsqldb:mem:testDb"

        }
    }
    production {
        dataSource {
            dbCreate = "update"
            url = "jdbc:hsqldb:file:prodDb;shutdown=true"

        }
    }
}
pls help me to execute
--
View this message in context: http://www.nabble.com/Problems-using-Grails-with-Postgresql-tp18565587p18565587.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: Problems using Grails with Postgresql

From
Richard Huxton
Date:
priyaa wrote:
> i am using postgresql instead of mysql ,but while execute i am getting error
> like
>
> Caused by: org.codehaus.groovy.runtime.InvokerInvocationException:
> org.springframework.dao.InvalidDataAccessResourceUsageException: could not
> execute query; nested exception is
> org.hibernate.exception.SQLGrammarException: could not execute query

How about providing the error message from the PostgreSQL logs? This
might mean something to a hibernate expert (although I doubt it), but it
doesn't tell me anything.

Make sure you are logging statement errors and show us the error. You
might want to log all statements while getting this to work, that would
give you some context.

--
   Richard Huxton
   Archonet Ltd

Re: Problems using Grails with Postgresql

From
"Scott Marlowe"
Date:
On Mon, Jul 21, 2008 at 5:00 AM, priyaa <pri8419@yahoo.co.in> wrote:
>
> i am using postgresql instead of mysql ,but while execute i am getting error
> like
>
>
> Caused by: org.codehaus.groovy.runtime.InvokerInvocationException:
> org.springframework.dao.InvalidDataAccessResourceUsageException: could not
> execute query; nested exception is
> org.hibernate.exception.SQLGrammarException: could not execute query
>
>
> my codings in datasource:
>
>
> dataSource {
>        pooled = false
>
>     driverClassName = "org.postgresql.Driver"
>        username ="sa"
>        password =""
> }
> hibernate {
>    cache.use_second_level_cache=true
>    cache.use_query_cache=true
>
> cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider'
>
> }
> // environment specific settings
> environments {
>        development {
>                dataSource {
>
>                        dbCreate = "update" // one of 'create', 'create-drop','update'
>                      url ="jdbc:postgresql://localhost:5432/test"
>                }
>        }
>        test {
>                dataSource {
>                        dbCreate = "update"
>                        url = "jdbc:hsqldb:mem:testDb"
>
>                }
>        }
>        production {
>                dataSource {
>                        dbCreate = "update"
>                        url = "jdbc:hsqldb:file:prodDb;shutdown=true"

Shouldn't that be a pgsql url not hsqldb right there?

It sounds like you're using the wrong db personality with hibernate.
You need hibernate to think in pgsql syntax for it to work right.