1

I am very new to spring, Consider a situation where two databases are being used in a spring app and they are configured (one is MySql and the other is PostGre), one service uses a table in MySql and other service uses a table in PostGre, now I want to know how do I provide them the required database connection during runtime?

Any help is appreciated. TIA

1 Answer 1

2

This answer explains how to configure two data sources for a single Spring Boot application.

Also, this tutorial explains the same concept with a detailed example.

The copying procedure could be done by fetching all the objects from each table on the main DB, deleting id values, and saving them to the second DB.

Sign up to request clarification or add additional context in comments.

1 Comment

The asker would like to configuration in runtime, meaning dynamically, but the examples provided work in a static way - compile time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.