I've created a spring batch to query a Azure SQL server database and write the data into a CSV file. I do not have create
permissions for the database. I get this error Invalid Object name BATCH_JOB_INSTANCE
on running the batch. I don't want the spring batch meta-data tables to be created in the main database. Or it would be helpful if I can have them in another local or in-memory db like h2db.
I've also added spring-batch-initialize-schema=never
already, which was the case with most answers to similar questions on here, but that didn't help.
Edit:
I resolved the Invalid Object name
error by preventing the metadata tables from being created into the main database by extending the DefaultBatchConfigurer
Class and Overriding the setDataSource
method, thus having them created in the in-memory map-repository. Now I want to try two options:
- How to have the meta data tables to be created in a local db or in-memory db like h2db.
- Or If I have the meta data tables created already in the main database, in a different schema than my main table I'm fetching from. How to point my job to those meta-data tables in another schema, to store the job and step details data in those.
@Configuration
public class SpringBatchConfig extends DefaultBatchConfigurer{
@Override
public void setDataSource(DataSource datasource) {
}
...
My application.properties file looks like this:
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring-batch-initialize-schema=never
spring.batch.job.enabled=false
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect