hibernate / hibernate-reactive

A reactive API for Hibernate ORM, supporting non-blocking database drivers and a reactive style of interaction with the database.
https://hibernate.org/reactive
Apache License 2.0
425 stars 89 forks source link

oracle connect error. #1675

Open KimDev88 opened 1 year ago

KimDev88 commented 1 year ago

Hello..

i use Oracle Autonomous Data Warehouse.

jdbc url example : jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=server_name)(PORT=port))(CONNECT_DATA=(SERVICE_NAME=serviceName)))

https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/connect-jdbc-thin-tls.html#GUID-364DB7F0-6F4F-4C42-9395-4BA4D09F0483

but connection error.

error message here

org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: begin 0, end -1, length 235
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:277) ~[hibernate-core-6.2.2.Final.jar:6.2.2.Final]
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
DavideD commented 1 year ago

Are you sure this is an issue for Hibernate Reactive? Which dependencies are in your project?

KimDev88 commented 1 year ago

I tested example source

DavideD commented 1 year ago

Hibernate Reactive doesn't use the JDBC driver.

You should check if you can do what you need with the Vert.x Oracle Client

KimDev88 commented 1 year ago

org.hibernate.reactive.pool.impl.DefaultSqlClientPoolConfiguration

oraclePath method return empty string oracleHost method throw exception

plese check this method..

build. gradle

dependencies {
    implementation project(':hibernate-reactive-core')

    // Hibernate Validator (optional)
    implementation 'org.hibernate.validator:hibernate-validator:7.0.2.Final'
    runtimeOnly 'org.glassfish:jakarta.el:3.0.3'

    // JPA metamodel generation for criteria queries (optional)
    annotationProcessor "org.hibernate.orm:hibernate-jpamodelgen:${hibernateOrmVersion}"

    // database drivers for PostgreSQL and MySQL
//    runtimeOnly "io.vertx:vertx-pg-client:${vertxVersion}"
//    runtimeOnly "io.vertx:vertx-mysql-client:${vertxVersion}"
    runtimeOnly "io.vertx:vertx-oracle-client:${vertxVersion}"

    // logging (optional)
    runtimeOnly "org.apache.logging.log4j:log4j-core:2.20.0"

    // Allow authentication to PostgreSQL using SCRAM:
    runtimeOnly 'com.ongres.scram:client:2.1'
}

persistence.xml 
org.hibernate.reactive.provider.ReactivePersistenceProvider org.hibernate.reactive.example.session.Author org.hibernate.reactive.example.session.Book
DavideD commented 1 year ago

It seems that the oracle driver supports this type of syntax. I will have a look as soon as I have some time. In the meanwhile, you can try this approach I've suggested some time ago on StackOverflow