首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >grails 3.3.9和PostgreSQL 12.7入门:错误"org.postgresql.Driver“

grails 3.3.9和PostgreSQL 12.7入门:错误"org.postgresql.Driver“
EN

Stack Overflow用户
提问于 2021-07-06 06:41:25
回答 1查看 37关注 0票数 0

我尝试在我的grails 3.3.9项目中连接postgresdatabase;我的posgrest服务器正在工作,因为我可以连接和操作Intelli 2021数据库中的posgres数据库,但我不能连接到grails 3.3.9。密码和用户是正确的,但它总是抛出这个错误:

代码语言:javascript
复制
Running application...
2021-07-05 19:06:25.298 ERROR --- [           main] org.postgresql.Driver                        : Connection error: 

org.postgresql.util.PSQLException: El servidor requiere autenticación basada en  contraseña, pero no se ha provisto ninguna contraseña.

这个mi Application.yml

代码语言:javascript
复制
hibernate:
   cache:
    queries: false
    use_second_level_cache: false
    use_query_cache: false

dataSource:
  IkebanaUsuarios:
    pooled: true
    jmxExport: true
    driverClassName: "org.postgresql.Driver"
    username: "postgres"
    password: "postgres"


environments:
    development:
      dataSource:
          dbCreate: update
          url: jdbc:postgresql://localhost:5432/IkebanaERP
test:
    dataSource:
        dbCreate: update
        url: jdbc:postgresql://localhost:5432/IkebanaERP
production:
    dataSource:
        dbCreate: update
        url: jdbc:postgresql://localhost:5432/IkebanaERP
        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

我的build.graddle是这样的

代码语言:javascript
复制
.......
compile "org.grails.plugins:cache"
compile "org.grails.plugins:async"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:events"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.16.Final"
compile "org.grails.plugins:gsp"
console "org.grails:grails-console"
profile "org.grails.profiles:web"
runtime "org.glassfish.web:el-impl:2.1.2-b03"
runtime "com.h2database:h2"
runtime "org.apache.tomcat:tomcat-jdbc"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.15.1"

runtime 'org.xerial:sqlite-jdbc:3.6.17'
runtime 'org.postgresql:postgresql:9.4.1208.jre1.8'
runtime 'mysql:mysql-connector-java:5.1.29'
runtime 'org.postgresql:postgresql:42.2.1.jre7'

testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails.plugins:geb"
testCompile "org.grails:grails-web-testing-support"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
}

请多关照;非常感谢

EN

回答 1

Stack Overflow用户

发布于 2021-07-06 23:24:11

您正在为Grails dataSource定义属性,但不是为Grails使用的默认属性定义属性。

您可以删除IkebanaUsuarios块,只保留以下内容:

代码语言:javascript
复制
dataSource:
    pooled: true
    jmxExport: true
    driverClassName: "org.postgresql.Driver"
    username: "postgres"
    password: "postgres"

或者,如果您还需要该辅助数据源,则可以同时定义这两个数据源的属性。我猜你不需要它,因为你没有提到故意要两个。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68262725

复制
相关文章

相似问题

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