2

I try to use postgresql with Spring cloud dataflow using this connection:

java -jar spring-cloud-dataflow-server-2.2.2.BUILD-SNAPSHOT.jar --spring.datasource.url=jdbc:postgresql://localhost:5432/test --spring.datasource.username=postgres --spring.datasource.password=root --spring.datasource.driver-class-name=org.postgresql.Driver

but it isn't take account this parameter.

I'm new to spring cloud data flow.

Simply Ged
  • 8,250
  • 11
  • 32
  • 40
LyLy
  • 41
  • 2

1 Answers1

0

The only difference between yours and how I start SCDF with the Postgres credentials is the wrapping of the value portion of the URL with sinlge-quotes.

Start Postgres:

docker run --name test-postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=spring -e POSTGRES_USER=spring -e POSTGRES_DB=dataflow postgres:10

Start SCDF:

java -jar spring-cloud-dataflow-server/target/spring-cloud-dataflow-server-2.3.0.BUILD-SNAPSHOT.jar --spring.datasource.url='jdbc:postgresql://localhost:5432/dataflow' --spring.datasource.username=spring --spring.datasource.password=spring --spring.datasource.driverClassName=org.postgresql.Driver

Logs: (look for "Postgres")

2019-11-25 14:55:57.884  INFO 93574 --- [           main] o.s.c.d.a.l.ProfileApplicationListener   : Setting property 'spring.cloud.kubernetes.enabled' to false.
  ____                              ____ _                __
 / ___| _ __  _ __(_)_ __   __ _   / ___| | ___  _   _  __| |
 \___ \| '_ \| '__| | '_ \ / _` | | |   | |/ _ \| | | |/ _` |
  ___) | |_) | |  | | | | | (_| | | |___| | (_) | |_| | (_| |
 |____/| .__/|_|  |_|_| |_|\__, |  \____|_|\___/ \__,_|\__,_|
  ____ |_|    _          __|___/                 __________
 |  _ \  __ _| |_ __ _  |  ___| | _____      __  \ \ \ \ \ \
 | | | |/ _` | __/ _` | | |_  | |/ _ \ \ /\ / /   \ \ \ \ \ \
 | |_| | (_| | || (_| | |  _| | | (_) \ V  V /    / / / / / /
 |____/ \__,_|\__\__,_| |_|   |_|\___/ \_/\_/    /_/_/_/_/_/

Spring Cloud Data Flow Server  (v2.3.0.BUILD-SNAPSHOT)

2019-11-25 14:55:58.055  INFO 93574 --- [           main] o.s.c.d.s.s.DataFlowServerApplication    : The following profiles are active: local
2019-11-25 14:55:59.133  INFO 93574 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!

...
...
...

2019-11-25 14:56:02.429  INFO 93574 --- [           main] o.f.c.internal.database.DatabaseFactory  : Database: jdbc:postgresql://localhost:5432/dataflow (PostgreSQL 10.11)

...
...

2019-11-25 14:56:03.804  INFO 93574 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2019-11-25 14:56:05.324  INFO 93574 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2019-11-25 14:56:05.336  INFO 93574 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-11-25 14:56:06.596  INFO 93574 --- [           main] o.s.b.c.r.s.JobRepositoryFactoryBean     : No database type set, using meta data indicating: POSTGRES
2019-11-25 14:56:06.658  INFO 93574 --- [           main] o.s.c.d.s.b.SimpleJobServiceFactoryBean  : No database type set, using meta data indicating: POSTGRES

...
...

2019-11-25 14:56:08.037  INFO 93574 --- [           main] o.s.c.d.s.s.DataFlowServerApplication    : Started DataFlowServerApplication in 12.809 seconds (JVM running for 13.754)
Sabby Anandan
  • 5,636
  • 2
  • 12
  • 21
  • Thank you @Sabby, when I try 'java -jar spring-cloud-dataflow-server/target/spring-cloud-dataflow-server-2.2.2.BUILD-SNAPSHOT.jar --spring.datasource.url='jdbc:postgresql://localhost:5432/dataflow' --spring.datasource.username=postgres --spring.datasource.password=root --spring.datasource.driverClassName=org.postgresql.Driver ' I have another error with flyway, for this I updated version of postgresql to 11 (the old version I was using was 9.2). Now it works properly. Thank you again – LyLy Nov 27 '19 at 07:13
  • There is one more way to do it by creating your spring boot application as spring cloud data flow server where you can define the datasources and other configuration in properties or cloud like any other spring boot application. Check this link for details: https://www.thetechnojournals.com/2019/12/setting-up-spring-cloud-data-flow-server.html – Ashok Prajapati Dec 10 '19 at 13:02