org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_EXECUTION_ID = ?]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00942: Tabelle oder View nicht vorhanden

Spring JIRA | Sven Bonacker | 7 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I'm using the latest release 2.1.3 and renamed the 'BATCH_'-tables with my own prefix. Everything works fine except calling JobOperator.stop(long executionId)! It seems as if the JdbcJobExecutiontDao is buggy, cause the tablePrefix is on default in the query. The bug seems to be similar to [#BATCH-723] ... Here is the stacktrace: {noformat} Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_EXECUTION_ID = ?]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00942: Tabelle oder View nicht vorhanden at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:602) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:665) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:673) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:716) at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForObject(SimpleJdbcTemplate.java:169) at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForObject(SimpleJdbcTemplate.java:174) at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao.getJobExecution(JdbcJobExecutionDao.java:244) at org.springframework.batch.core.explore.support.SimpleJobExplorer.getJobExecution(SimpleJobExplorer.java:113) at org.springframework.batch.core.launch.support.SimpleJobOperator.findExecutionById(SimpleJobOperator.java:389) at org.springframework.batch.core.launch.support.SimpleJobOperator.stop(SimpleJobOperator.java:374) ... {noformat}

    Spring JIRA | 7 years ago | Sven Bonacker
    org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_EXECUTION_ID = ?]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00942: Tabelle oder View nicht vorhanden
  2. 0

    I'm using the latest release 2.1.3 and renamed the 'BATCH_'-tables with my own prefix. Everything works fine except calling JobOperator.stop(long executionId)! It seems as if the JdbcJobExecutiontDao is buggy, cause the tablePrefix is on default in the query. The bug seems to be similar to [#BATCH-723] ... Here is the stacktrace: {noformat} Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_EXECUTION_ID = ?]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00942: Tabelle oder View nicht vorhanden at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:602) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:665) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:673) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:716) at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForObject(SimpleJdbcTemplate.java:169) at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForObject(SimpleJdbcTemplate.java:174) at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao.getJobExecution(JdbcJobExecutionDao.java:244) at org.springframework.batch.core.explore.support.SimpleJobExplorer.getJobExecution(SimpleJobExplorer.java:113) at org.springframework.batch.core.launch.support.SimpleJobOperator.findExecutionById(SimpleJobOperator.java:389) at org.springframework.batch.core.launch.support.SimpleJobOperator.stop(SimpleJobOperator.java:374) ... {noformat}

    Spring JIRA | 7 years ago | Sven Bonacker
    org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_EXECUTION_ID = ?]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00942: Tabelle oder View nicht vorhanden

    Root Cause Analysis

    1. org.springframework.jdbc.BadSqlGrammarException

      PreparedStatementCallback; bad SQL grammar [SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, EXIT_CODE, EXIT_MESSAGE, CREATE_TIME, LAST_UPDATED, VERSION from BATCH_JOB_EXECUTION where JOB_EXECUTION_ID = ?]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00942: Tabelle oder View nicht vorhanden

      at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate()
    2. Spring Framework
      SimpleJdbcTemplate.queryForObject
      1. org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233)
      2. org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
      3. org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:602)
      4. org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636)
      5. org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:665)
      6. org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:673)
      7. org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:716)
      8. org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForObject(SimpleJdbcTemplate.java:169)
      9. org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForObject(SimpleJdbcTemplate.java:174)
      9 frames
    3. Spring Batch Core
      SimpleJobOperator.stop
      1. org.springframework.batch.core.repository.dao.JdbcJobExecutionDao.getJobExecution(JdbcJobExecutionDao.java:244)
      2. org.springframework.batch.core.explore.support.SimpleJobExplorer.getJobExecution(SimpleJobExplorer.java:113)
      3. org.springframework.batch.core.launch.support.SimpleJobOperator.findExecutionById(SimpleJobOperator.java:389)
      4. org.springframework.batch.core.launch.support.SimpleJobOperator.stop(SimpleJobOperator.java:374)
      4 frames