Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring boot application error with connect PostgreSQL database [duplicate]

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

like image 413
Michu93 Avatar asked Apr 05 '18 10:04

Michu93


2 Answers

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

like image 57
Ruslan Akhundov Avatar answered Oct 20 '22 15:10

Ruslan Akhundov


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
like image 3
Deb Avatar answered Oct 20 '22 14:10

Deb