7

I just generated new project on https://start.spring.io/, added

  1. Web
  2. Security
  3. JPA
  4. PostgreSQL

then I have Description:

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.

So I added

spring.datasource.url= jdbc:postgresql://10.1.2.5/vlex

spring.datasource.username=myUser
spring.datasource.password=myPassword

spring.jpa.hibernate.ddl-auto=none

into application.properties and now I have:

java.lang.reflect.InvocationTargetException: null
Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.

I cannot overcome this problem and stuck here. Is there any way to use PostgreSQL 9.6 in Spring Boot application? I haven't edited anything but application.properties

Michu93
  • 5,058
  • 7
  • 47
  • 80

2 Answers2

6

Try adding property:

spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

or if you have specific hibernate.xml you can set same property there to true

There is issue on github: https://github.com/spring-projects/spring-boot/issues/12007

Similar issue: Postgres Error method org.postgresql.jdbc.PgConnection.createClob() is not implemented

Ruslan Akhundov
  • 2,178
  • 4
  • 20
  • 38
3

For PostgreSQL you need to set this two property

spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
Deb
  • 2,922
  • 1
  • 16
  • 32
  • Works but this one below also works no idea which answer should I accept – Michu93 Apr 05 '18 at 10:14
  • 1
    Are you sure that `spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect` is required ? It should not I think. – davidxxx Apr 05 '18 at 10:16
  • Even: spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false is enough – Michu93 Apr 05 '18 at 10:17
  • Ahh Okay I see. I faced this issue sometimes ago. This two line saved me. Now I know only one line would be enough. Thanks guys – Deb Apr 05 '18 at 10:19
  • @Michu93 spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false - probably does much more then property I mentioned in my answer, so in case you have only exception you stated in question, I would've used specific property for this problem – Ruslan Akhundov Apr 05 '18 at 10:19