I am using IntelliJ IDEA 15.0.2 as an IDE. I have created a Grails 3.0 application and changed it a bit to configure PostgreSQL.
Here is my dataSource:
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
And in my build.gradle
I added runtime "postgresql:postgresql:9.4-1207.jdbc4"
.
But that gives errors when I run:
ERROR org.apache.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool. java.sql.SQLException: org.postgresql.Driver
What have I missed?
Advertisement
Answer
Data source
dataSource { pooled = true jmxExport = true driverClassName = "org.postgresql.Driver" username = "postgres" password = "xxx"
Build Config
dependencies { // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g. // runtime 'mysql:mysql-connector-java:5.1.29' // runtime 'org.postgresql:postgresql:9.3-1101-jdbc41' runtime "org.postgresql:postgresql:9.4.1208.jre7" test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4" }
Change the jre number according to your db numbe psql version. Hope i helped. Cheers!