javaspring-bootmultiple-databases

How to configure second database (For only Select queries) in Spring Boot


I have a spring boot project with a MySql DB already configured along with the migration scripts.

I have a new requirement where I have to configure an Oracle database(part of another application) to my application.

I understand that we can configure multiple databases in spring boot project. But I need to configure Oracle DB such that the migration scripts writtrn for MySQL doesn't apply onto it as I have to perform only select queries on Oracle database.

I am expecting to configure the Oracle database as a read only database without affecting the existing configuration for MySQL database.


Solution

  • The easiest solution would be creating a read-only user in the Oracle database, and in the application.properties file, you should replace the old database user information with the read-only user's information.