Search code examples
javaoracle-databasejdbc

Java application RAC- aware


Is it necessary from a developer POV to know that application is hosted on RAC oracle database? Do we need to add any additional mechanism for making Java application RAC-aware? Can application maintain database connectivity even when there is a single node failure? Do we need to perform any additional RAC-aware tests on Java application?


Solution

  • It depends on what you want.

    • Do you want zero downtime patching?
    • Do you need to balance load between nodes?
    • Does your application want just to re-connect to any surviving node in case of failure?

    Here are mine recommendations:

    • Do NOT use default DB service for connecting, create a dedicated DB service for your app
    • Use connection pool either HikariCP or UCP
    • UCP is Oracle's RAC aware load balacing connection pool library. See this project to find an example how to integrate your Hibernate/Spring with UCP
    • RAC "only" guarantees that database will be up and running, even if one of the cluster nodes is lost. If your app wants to also preserve data from non-committed transactions, you have to either implement re-try mechanism in your app or you have to configure your connection pool to use "JDBC Application Continuity" datasource.