I am able to connect to Postgresql database using Spring Data Reactive locally and using my H2 in-memory database for local testing. However, when I deploy the app on a Kubernetes cluster with a Postgresql database cluster I keep getting the following error:
Caused by: io.r2dbc.postgresql.ExceptionFactory$PostgresqlAuthenticationFailure: pg_hba.conf rejects connection for host "10.244.2.232", user "myuser", database "account", no encryption
at io.r2dbc.postgresql.ExceptionFactory.createException(ExceptionFactory.java:75) ~[r2dbc-postgresql-0.8.10.RELEASE.jar!/:0.8.10.RELEASE]
at io.r2dbc.postgresql.ExceptionFactory.handleErrorResponse(ExceptionFactory.java:111) ~[r2dbc-postgresql-0.8.10.RELEASE.jar!/:0.8.10.RELEASE]
at reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:103) ~[reactor-core-3.4.13.jar!/:3.4.13]
The following is my application.yml that contains the spring r2dbc url:
spring:
r2dbc:
url: r2dbc:postgresql://${POSTGRES_SERVICE}/${POSTGRES_DBNAME}
username: ${POSTGRES_USERNAME}
password: ${POSTGRES_PASSWORD}
I do have another Springboot app that is not reactive which can connect to a another Postgresql cluster.
Is there a specific param that I need to send to my query string?
Related
I am currently working on Spring Boot project which is connected to Postgres database. I am using PG Admin tool to connected to database. While I am running my project, I am getting exception and that is related to database.
The password I am giving is correct, still it is not connecting to the database. I am not using any AWS services.
How I can resolve this issues related to timeout expired?
I have a little issue. I was working on the dev mode in Jhipster with H2.
And now I'm trying the prod mode but there's an issue with the connection to the PostgreSQL server. I'm using pgAdmin4.
It says that the password can't be null and if I put a password it doesn't like to.
Its the first running, so I imagine that the application create the DB. Am'I wrong?
I'm new on Spring boot & JHipster.
Its the standard configuration.
there's the configuration:
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgresql://localhost:5432/KoseCleaning
username: KoseCleaning
password:
hikari:
poolName: Hikari
auto-commit: false
Edit:
Errors:
Without password:
Caused by: java.lang.IllegalArgumentException: Null value for 'password'
With password :
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "XXX"
Thanks in advance.
The app does not create the db nor users, you must do it. Liquibase only creates the objects (tables, indexes, ...) in an existing schema.
As a side note, I'd recommend not using H2 in dev, rather use same db as in prod with testcontainers profile generated by JHipster to discover problems earlier and get access to the full power of your database rather than limiting you to a subset supported by H2.
I am trying to create a connection from AWS Glue to MongoDB, but when I test the connection it fails with error: "Check that your connection definition references your Mongo database with correct URL syntax, username, and password. Exiting with error code 30". I know that my connection parameters are correct because I can connect with the same host, port, database, user name, and password from another client application (DataGrip). And I know that my VPC configuration should be correct too because I have another connection in the Glue, to connect to the PostgreSQL database on-premise with public IP, that works just fine.
My MongoDB version is 4.4.1. I am out of ideas what else can cause the problem. Is anyone successfully connects to MongoDB form Glue and run the Crawler?
I am trying to start two different Spring Boot Camunda applications. The first one boots perfectly fine, and creates the table and everything in the DB. However when I try to boot the second application it fails. Just to be clear, I want the applications to experience their schema as their own database if that makes sense. The error I get when booting the second Spring Boot Application is:
ENGINE-16004 Exception while closing command context:
### Error querying database. Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
Position: 15
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Property.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
Position: 15
I only have one Postgres DB, but the applications connect to the DB with different username/password. Their user has it's own schema, and does not have any access to the other schemas in the DB.
The following application properties are set for both applications: camunda.bpm.datasource.schema-update=true.
After reading the documentation on Camunda I can see that .schema-update=true should create the tables if they don't exist.
I don't understand why the second application does not create the tables.
For the Postgres schema configuration I create them with the following commands:
CREATE USER applicationName WITH PASSWORD 'r4nd0m';
CREATE SCHEMA AUTHORIZATION applicationName;
I don't know if the issue is with configuring the Camunda applications or with privileges/creation regarding the schemas.
Any help would be appreciated!
Yes, you can. This project shows you how to configure two independent Camunda instances, which use two separate schemas within the same database.
https://github.com/rob2universe/two-camunda-instances
The essential properties are:
Spring.datasource:
url: jdbc:postgresql://localhost:5432/postgres?autoReconnect=true
username: cam1
password: cam1
driver-class-name: org.postgresql.Driver
server.port: 8081
server:
servlet:
context-path: /cam1
camunda:
bpm:
database:
schema-name: cam1
table-prefix: cam1.
I provisioned Databases for PostgreSQL on IBM Cloud. Now I try to connect SQuirreL to my database. However, my attempts result in this error:
FATAL: no pg_hba.conf entry for host "xx.xx.xx.xx", user "myuser",
database "my-database", SSL off
Is this related to the JDBC driver or any SSL setting? The credentials say sslmode=verify-full, but not sure how to specify it in SQuirreL.
I was able to connect with the standard JDBC driver for PostgreSQL after changing the driver properties:
Simple, but not secure approach:
- ssl=true
- sslfactory=org.postgresql.ssl.NonValidatingFactory
Secure, more effort:
- download the SSL certificate as provided in the credentials
- add ?sslmode=verify-full&sslrootcert=path-to-certificate to the connection URI
Now SQuirrel connects to my database with IBM Cloud Databases for PostgreSQL. This also works with Hyper Protect DBaaS.