Reputation: 2002
I am using Spring boot 1.5.18.RELEASE.
I have followed multiple data sources using following link:
but its working when I have data sources in same server.
Here is my case:
In above case, spring boot application is trying to check for table in server 1 only and as a result I am getting sql exception something like
SqlExceptionHelper - SQL Error: 1146, SQLState: 42S02
SqlExceptionHelper - Table 'datasource2.table2' doesn't exist
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table
'datasource2.table2' doesn't exist
How to resolve this issue ?
Upvotes: 8
Views: 6103
Reputation: 1
If your tables are of same server (irrespective of databases (same or differ)) then it is possible to join with eachother. But if they belong different servers then it supports by the MySql as FEDERATED Engine . You can have look to this question for more details.
Upvotes: 0
Reputation: 1
No, You can't do it. As each JPARepository belong to only on EntityManager and entity manager relate to a single database.
Upvotes: 0