1

I have configured multiple data sources by following :

http://roufid.com/spring-boot-multiple-databases-configuration/

Please note that I have used same database vendor i.e., MYSQL

Data source 1: I made this as @Primary

DB: db1

Tables: table1, table2, table3

Data source 2:

DB: db2

Tables: table4

When I was trying to query on table4 (data source2: db2), I got exception like below:

SQL Error: 1146, SQLState: 42S02
Table 'db2.table4' doesn't exist

But If I changed @Primary from db1 to db2, its working.

Is anyone aware why its behaving like that ? Any configuration is missing ?

Krish
  • 1,804
  • 7
  • 37
  • 65
  • Possible duplicate of [Spring Boot, Spring Data JPA with multiple DataSources](https://stackoverflow.com/questions/26308035/spring-boot-spring-data-jpa-with-multiple-datasources) – Nikolai Shevchenko Apr 14 '18 at 10:00

0 Answers0