hibernate-reactive icon indicating copy to clipboard operation
hibernate-reactive copied to clipboard

oracle connect error.

Open KimDev88 opened this issue 2 years ago • 5 comments

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: 

KimDev88 avatar Jun 20 '23 09:06 KimDev88

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

DavideD avatar Jun 20 '23 11:06 DavideD

I tested example source

KimDev88 avatar Jun 20 '23 13:06 KimDev88

Hibernate Reactive doesn't use the JDBC driver.

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

DavideD avatar Jun 20 '23 13:06 DavideD

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
    <class>org.hibernate.reactive.example.session.Author</class>
    <class>org.hibernate.reactive.example.session.Book</class>

    <properties>

        <!-- MySQL -->
        <property name="jakarta.persistence.jdbc.url"
                  value="jdbc:oracle:thin:@(DESCRIPTION=(RETRY_COUNT=20)(RETRY_DELAY=3)(ADDRESS=(PROTOCOL=TCPS)(PORT=1521)(HOST=ADB.AP-CHUNCHEON-1.ORACLECLOUD.COM))(CONNECT_DATA=(SERVICE_NAME=****************))(SECURITY=(SSL_SERVER_DN_MATCH=YES)))"/>

        <!-- Credentials -->
        <property name="jakarta.persistence.jdbc.user"
                  value="*******"/>
        <property name="jakarta.persistence.jdbc.password"
                  value="*******"/>

        <!-- The Vert.x SQL Client connection pool size -->
        <property name="hibernate.connection.pool_size"
                  value="10"/>

        <!-- Automatic schema export -->
        <property name="jakarta.persistence.schema-generation.database.action"
                  value="drop-and-create"/>

        <!-- SQL statement logging -->
        <property name="hibernate.format_sql" value="true"/>
        <!--property name="hibernate.show_sql" value="true"/-->

    </properties>

</persistence-unit>

KimDev88 avatar Jun 20 '23 13:06 KimDev88

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

DavideD avatar Jun 20 '23 14:06 DavideD