Failed to obtain R2DBC Connection with Oracle R2DBC driver - oracle

I try to connect to oracle db (v19) via oracle's r2dbc driver and spring data r2dbc but receive Failed to obtain R2DBC Connection error. Did not observe any item or terminal signal within 10000ms in 'Connection Allocation'
I suspect that my r2dbc-pool configuration is not correct. I tried several combinations but none of them fixed the issue.
I referred this issue https://github.com/spring-projects/spring-data-r2dbc/issues/810, and adjusted my pool configuration, but it didn't work. I increased max-create-connection-time but i didn't work also.
Spring Boot version: 3.0.1
Spring Boot Data R2DBC: 3.0.0
Project Reactor: 3.5.1
R2DBC SPI: 1.0.0.RELEASE
R2DBC Pool: 1.0.0.RELEASE
JDK version: 17
this my configuration which I use for connection.
r2dbc:
name: demo-db
url: r2dbc:oracle://192.168.1.98:1521/testdb
username: testdb
password: testdb
pool:
enabled: true
initial-size: 10
validation-query: SELECT 1 FROM DUAL
max-life-time: 120000
max-create-connection-time: 10000
validation-depth: remote

Related

Not able to connect to H2 database in Spring Boot

I have the below in my yaml file.I keep getting the below error.how to resolve the below error.I am using latest spring boot version .
org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database
"C:/Users/mynname/test" not found, either pre-create it or allow
remote database creation (not recommended in secure environments)
[90149-214]
I can see the H2 console in http://localhost:8080/h2.But when i click on connect button i get the error.
spring:
h2:
console:
enabled: true
path: /h2
datasource:
url: jdbc:h2:mem:testdb
username: sa
password:
driverClassName: org.h2.Driver
jpa:
spring.jpa.database-platform: org.hibernate.dialect.H2Dialect
hibernate.ddl-auto: create
On the h2 console change the default ur that appears there (jdbc:h2:mem:test) to jdbc:h2:mem:testdb
And you should be able to connect

Quarkus Devservice for Oracle Database is not working

I am working on Quarkus Microservice application in which trying to use Quarkus Devservice to start Oracle DB with below configuration in application.yml file. But it's throwing exception.
application.yml:
quarkus:
datasource:
db-kind: oracle
username: root
password: password
devservices:
image-name: oracle
Exception:
Failed to load steps from class 'io.quarkus.devservice.oracle.deployment.OracleDevServicesProcessoer'

Cannot find database driver: net.snowflake.client.jdbc.SnowflakeDriver

I was following getting started with liquibase on snowflake to set up Snowflake db connection to liquibase, but with the following liquibase.properties file:
driver: net.snowflake.client.jdbc.SnowflakeDriver
classpath: ./liquibase-snowflake-1.0.jar
url: jdbc:snowflake://XXXXXXX.snowflakecomputing.com
username: YYYYYYYYY
password: ZZZZZZZZZZ
changeLogFile: mySnowflakeChangeLog.xml
I get a Snowflake driver error from liquibase:
Unexpected error running Liquibase: java.lang.RuntimeException: Cannot find database driver: net.snowflake.client.jdbc.SnowflakeDriver
I checked that the driver being used is the correct one mentioned on the official documentation https://docs.snowflake.net/manuals/user-guide/jdbc-configure.html . This is on JDK 13.0.1 and liquibase 3.8.2.
What is going wrong here / any suggestions on a workaround? Thanks in advance!

how to configure both mongodb and postgres in spring boot application.yml?

We have spring boot project , in which we need to use mongo and postgres , but i thought am failing in configuring mongo and postgres details applicaiton.yml , below my what i configured , can any one please help me
spring:
profiles: stage
data:
mongodb:
host: mongodb-host
port: 27017
password: password
username: username
authentication-database: database
database: database
datasource:
driver-class-name: org.postgresql.Driver
url: postgres-url
username: user-name
password: password
tomcat:
validation-interval: 30000
test-on-borrow: true
validation-query: SELECT 1
when i start my spring-boot application , it is failing to start with below error
Caused by: java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName.
can any one please help
Solution 1: remove spring.datasource.driver-class-name property
Solution 2: rename the spring.datasource.url property to spring.datasource.jdbc-url.
For solution 1 Spring Boot will figure out the default driver class name based on the spring.datasource.url property value.

Spring Boot 1.3.5 with Hikari Connection Pool not able to set program name in v$session

I have a JHipster spring boot ver 1.3.5 application which connects to Oracle DB using Hikari Connection Pool. I am unable to set the program in v$session which should be possible by adding below in my application YAML
hikari:
v$session:
program: AppName
username: DB_USER
I have tried adding these at spring.datasource level, datasource.hikari level and datasource level.
I also looked at Hibernate 4.3.5 ignores v$session.program configuration property but that did not work as well.
Update 1 - I tried all the below and none seem to work
spring.datasource.hikari.datasourceProperties.v$session.program AppName
spring.datasource.hikari.datasourceProperties.v$session.username DB_USER
datasource.hikari.v$session.program AppName
datasource.hikari.v$session.username DB_USER
datasource.hikari.datasourceProperties.v$session.program AppName
datasource.hikari.datasourceProperties.v$session.username DB_USER
hikari.v$session.program AppName
hikari.v$session.username DB_USER
hikari.datasourceProperties.v$session.program AppName
hikari.datasourceProperties.v$session.username DB_USER
Following works in Spring Boot 1.5.8.RELEASE using application.yml file:
spring:
datasource:
hikari:
data-source-properties:
v$session.program: AppName
In Spring Boot 2 use:
spring:
datasource:
hikari:
data-source-properties:
"[v$session.program]": AppName

Resources