首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为Postgresql配置Grails 3

为Postgresql配置Grails 3
EN

Stack Overflow用户
提问于 2018-10-31 21:12:35
回答 1查看 554关注 0票数 1

我一直试图获得grails 3连接到postgres,但无法获得连接。

这在我的构建文件中:runtime "org.postgresql:postgresql:42.2.5"

和application.yml数据源:

代码语言:javascript
复制
dataSource:
    pooled: true
    jmxExport: true
    driverClassName: 'org.Postgresql.Driver'
    dialect: 'org.hibernate.dialect.PostgreSQLDialect'
    username: 'okcomputer'
    password: ''

environments:
    development:
        dataSource:
            dbCreate: create-drop
            url: jdbc:postgresql://localhost:5432/test
    test:
        dataSource:
            dbCreate: update
            url: jdbc:postgresql://localhost:5432/test
    production:
        dataSource:
            dbCreate: none
            url: jdbc:postgresql://localhost:5432/test
            properties:
                jmxEnabled: true
                initialSize: 5
                maxActive: 50
                minIdle: 5
                maxIdle: 25
                maxWait: 10000
                maxAge: 600000
                timeBetweenEvictionRunsMillis: 5000
                minEvictableIdleTimeMillis: 60000
                validationQuery: SELECT 1
                validationQueryTimeout: 3
                validationInterval: 15000
                testOnBorrow: true
                testWhileIdle: true
                testOnReturn: false
                jdbcInterceptors: ConnectionState
                defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED

我在这里做错什么了?我确信数据库是存在的,并且用户/pass是正确的,但我不知道要做什么才能排除故障。这里有一个完整的堆栈跟踪:https://pastebin.com/THrALVaE

(我使用的是java 1.8和grails 3.3.8)

关于grails和postgres有一个令人惊讶的小信息,所以感谢大家提前!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-31 21:19:34

驱动程序名称可能应该是org.postgresql.Driver而不是org.Postgresql.Driver。在JVM上,类名和包名区分大小写。

代码语言:javascript
复制
dataSource:
    pooled: true
    jmxExport: true
    driverClassName: 'org.postgresql.Driver'
    dialect: 'org.hibernate.dialect.PostgreSQLDialect'
    username: 'okcomputer'
    password: ''
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53092030

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档