0
votes

I am creating a spring-batch application which reads from a CSV file and writes into a DB2 database.

Spring-boot version : 2.0.5.RELEASE

<dependency>
    <groupId>com.ibm.db2.jcc</groupId>
    <artifactId>db2jcc</artifactId>
    <version>db2jcc4</version>
</dependency>

I am getting an BadSqlGrammarException when Spring Batch tries to insert into the BATCH_JOB_EXECUTION table.

Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT into BATCH_JOB_EXECUTION(JOB_EXECUTION_ID, JOB_INSTANCE_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, VERSION, CREATE_TIME, LAST_UPDATED, JOB_CONFIGURATION_LOCATION) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=JOB_CONFIGURATION_LOCATION, DRIVER=4.26.14Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT into BATCH_JOB_EXECUTION(JOB_EXECUTION_ID, JOB_INSTANCE_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, VERSION, CREATE_TIME, LAST_UPDATED, JOB_CONFIGURATION_LOCATION) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=JOB_CONFIGURATION_LOCATION, DRIVER=4.26.14

Thanks in advance for any kind of support and direction that helps in resolving this issue.

1

1 Answers

1
votes
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=JOB_CONFIGURATION_LOCATION

From this, SQLSTATE 42703 means An undefined column or parameter name was detected . So it is most probably due to the BATCH_JOB_EXECUTION does not have JOB_CONFIGURATION_LOCATION column.

Make sure your batch related tables have the schema that are the same as this.