I have different database connections but same tables in them. So for reusing those entity classes I have to fetch schema name dynamically. Tried to set schema in properties file and in datasource and is not working.
application.properties file :
spring.datasource1.url=jdbc:db2://localhost:5054/AB01
spring.datasource1.username=abc
spring.datasource1.password=abc
spring.datasource1.driver-class-name=com.ibm.db2.jcc.DB2Driver
spring.datasource1.testWhileIdle=true
spring.datasource1.validationQuery=SELECT 1
Have tried to set schema in properties file as below and got error "The DDM parameter value is not supported. DDM parameter code point having unsupported value : 0x2110." error.
spring.datasource.url=jdbc:db2://localhost:5054/AB01?currentSchema=schema
spring.datasource.url=jdbc:db2://localhost:5054/AB01?search_path=schema
spring.datasource.url=jdbc:db2://localhost:5054/AB01?searchpath=schema
Tried like below in configuration class also but not working.
public DataSource dataSource() {
DriverManagerDataSource ds = new DriverManagerDataSource(databaseURL, username, pwd);
ds.setDriverClassName(driverClassName);
Properties connectionProperties = new Properties();
connectionProperties.setProperty("spring.datasource.schema", "schema");
ds.setConnectionProperties(connectionProperties);
return ds;
}