oracle-databasejdbcquarkusconnection-pool

How can I specify the current schema on quarkus datasource?


Hi I am trying to configure the quarkus to connect to a oracle database. With the current configuration I am able to connect to the database, but I cannot specify the current schema.

I followed the documentation and try to use the new-connection-sql to set the current schema. But it doesn't seems to work.

quarkus.datasource.mydatasource.new-connection-sql=ALTER SESSION SET CURRENT_SCHEMA=SCHEMA_NAME

Here is my application.properties file

quarkus.datasource.mydatasource.db-kind=oracle
quarkus.datasource.mydatasource.jdbc.driver=oracle.jdbc.driver.OracleDriver
quarkus.datasource.mydatasource.jdbc.url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.15.73.140)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=SN)))
quarkus.datasource.mydatasource.jdbc.min-size=3
quarkus.datasource.mydatasource.jdbc.max-size=20
quarkus.datasource.mydatasource.username=username
quarkus.datasource.mydatasource.password=password
quarkus.datasource.mydatasource.new-connection-sql=ALTER SESSION SET CURRENT_SCHEMA=SCHEMA_NAME

What could be the issue here?

Thank you.


Solution

  • This is working fine if you add the jdbc sub path name to the property

    quarkus.datasource.mydatasource.jdbc.new-connection-sql=ALTER SESSION SET CURRENT_SCHEMA=SCHEMA_NAME
    

    You can refer to these Quarkus configuration references: