问题
I have a spring boot batch application. In application.properties, i specify my datasource details as follows
spring.datasource.url=jdbc:jtds:sqlserver://1*.2**.6*.25:14**
spring.datasource.database=MYDB_DEV
spring.datasource.username=username
spring.datasource.password=password
The problem is, when i run the batch job, all user defined tables are taken from the MYDB_DEV. But Metadata tables like BATCH_JOB_EXECUTION, BATCH_JOB_EXECUTION_CONTEXT are taken from the MASTER schema even though i have created the same tables in MYDB_DEV. Why this happens? Is there any work around to make the application read Metadata tables from user defined schema?
I have debugged though the jobLauncher.run(myjob, jobParameters), Could not find any lead from where it is taking master Schema
回答1:
Use below property in application.properties or application.yml
spring.batch.tablePrefix=MYDB_DEV.BATCH_
来源:https://stackoverflow.com/questions/56169099/why-spring-batch-reads-metadata-tables-from-master-and-not-from-user-defined-sch