英文:
How to configure second database (For only Select queries) in Spring Boot
问题
我有一个Spring Boot项目,已经配置好了一个MySQL数据库以及迁移脚本。
我有一个新的需求,需要将一个Oracle数据库(属于另一个应用程序)配置到我的应用程序中。
我理解在Spring Boot项目中可以配置多个数据库。但我需要配置Oracle数据库,以便不将为MySQL编写的迁移脚本应用到它上,因为我只需要在Oracle数据库上执行选择查询。
我希望将Oracle数据库配置为只读数据库,而不影响现有的MySQL数据库配置。
英文:
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.
答案1
得分: 1
最简单的解决方案是在Oracle数据库中创建一个只读用户,并在application.properties文件中,用只读用户的信息替换旧数据库用户的信息。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论