【发布时间】:2016-01-15 18:55:29
【问题描述】:
我使用 IntelliJ IDEA 15.0.2 作为 IDE。我创建了一个 Grails 3.0 应用程序并对其进行了一些更改以配置 PostgreSQL。
这是我的数据源:
dataSource:
pooled: true
jmxExport: true
driverClassName: org.postgresql.Driver
username: postgres
password: root
environments:
development:
dataSource:
dbCreate: update
url: jdbc:postgresql://localhost:5432/trace_db
test:
dataSource:
dbCreate: update
url: jdbc:postgresql://localhost:5432/trace_db
production:
dataSource:
dbCreate: update
url: jdbc:postgresql://localhost:5432/trace_db
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.gradle 中,我添加了runtime "postgresql:postgresql:9.4-1207.jdbc4"。
但是当我运行时会出错:
ERROR org.apache.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool.
java.sql.SQLException: org.postgresql.Driver
我错过了什么?
【问题讨论】:
-
类路径中是否有 postgresql JDBC 驱动程序?
-
请接受一个答案。
标签: java postgresql grails jdbc intellij-idea