My Advice: Currently I am using a dynamic datasource, the main datasource is pgsql, and the secondary datasource is oracle. Currently, for multi-database compatibility, database may be changed. Different xml files are executed by specifying the databaseId, but the databaseId will only be initialized once, switching the datasource databseId does not change. Hope to provide a way to dynamically identify the datasource and change the value of databaseId. Thanks!
Comment From: JiHongYuan
I think you should create two SqlSessionFactory to solve this problem. use different datasource create SqlSessionFactory, switch environment.
Comment From: davidhxy678
@JiHongYuan how to do
Comment From: Faputa
@JiHongYuan how to do
He means using multi datasource rather than dynamic datasource.