org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [select count(*) from BATCH_JOB_INSTANCE]; nested exception is java.sql.SQLException: Table not found in statement [select count(*) from BATCH_JOB_INSTANCE]

Spring JIRA | Chris Schaefer | 4 years ago
  1. 0

    schema-hsqldb.sql wasn't being found, DataSourceInitializer.doExecuteScript will just return if the scriptResource does not exist. easy fix, pull request to come. {noformat} org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [select count(*) from BATCH_JOB_INSTANCE]; nested exception is java.sql.SQLException: Table not found in statement [select count(*) from BATCH_JOB_INSTANCE] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:220) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:466) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:474) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:479) at org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:488) at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt(SimpleJdbcTemplate.java:119) at org.springframework.batch.core.launch.JobLauncherIntegrationTests.testLaunchAndRelaunch(JobLauncherIntegrationTests.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160) at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:233) at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333) at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217) at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197) at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97) at org.junit.runner.JUnitCore.run(JUnitCore.java:130) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.sql.SQLException: Table not found in statement [select count(*) from BATCH_JOB_INSTANCE] at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source) at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source) at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:443) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:396) ... 33 more {noformat}

    Spring JIRA | 4 years ago | Chris Schaefer
    org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [select count(*) from BATCH_JOB_INSTANCE]; nested exception is java.sql.SQLException: Table not found in statement [select count(*) from BATCH_JOB_INSTANCE]
  2. 0

    schema-hsqldb.sql wasn't being found, DataSourceInitializer.doExecuteScript will just return if the scriptResource does not exist. easy fix, pull request to come. {noformat} org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [select count(*) from BATCH_JOB_INSTANCE]; nested exception is java.sql.SQLException: Table not found in statement [select count(*) from BATCH_JOB_INSTANCE] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:220) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:466) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:474) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:479) at org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:488) at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt(SimpleJdbcTemplate.java:119) at org.springframework.batch.core.launch.JobLauncherIntegrationTests.testLaunchAndRelaunch(JobLauncherIntegrationTests.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160) at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:233) at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333) at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217) at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197) at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97) at org.junit.runner.JUnitCore.run(JUnitCore.java:130) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.sql.SQLException: Table not found in statement [select count(*) from BATCH_JOB_INSTANCE] at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source) at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source) at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:443) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:396) ... 33 more {noformat}

    Spring JIRA | 4 years ago | Chris Schaefer
    org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [select count(*) from BATCH_JOB_INSTANCE]; nested exception is java.sql.SQLException: Table not found in statement [select count(*) from BATCH_JOB_INSTANCE]
  3. 0

    how to resolve java.sql.SQLException: Table not found in statement

    Stack Overflow | 4 years ago | user1551750
    java.sql.SQLException: Table not found in statement [select * from "PUBLIC"."xxx"]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Connect to Open Office odb file using jdbc program

    Stack Overflow | 5 years ago | Harshavardhan Konakanchi
    java.sql.SQLException: Table not found in statement [SELECT * FROM Emp]
  6. 0

    HSQLDB issue: Using HSQL as backend for the existing MVC application using JDBC template

    Stack Overflow | 5 years ago | AbdulAziz
    java.sql.SQLException: Table not found in statement [select id, description, price from products]

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.sql.SQLException

      Table not found in statement [select count(*) from BATCH_JOB_INSTANCE]

      at org.hsqldb.jdbc.Util.sqlException()
    2. HSQLDB
      jdbcStatement.executeQuery
      1. org.hsqldb.jdbc.Util.sqlException(Unknown Source)
      2. org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
      3. org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
      3 frames
    3. Spring Framework
      SimpleJdbcTemplate.queryForInt
      1. org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:443)
      2. org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:396)
      3. org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:220)
      4. org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
      5. org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407)
      6. org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458)
      7. org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:466)
      8. org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:474)
      9. org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:479)
      10. org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:488)
      11. org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt(SimpleJdbcTemplate.java:119)
      11 frames
    4. Spring Batch Core
      JobLauncherIntegrationTests.testLaunchAndRelaunch
      1. org.springframework.batch.core.launch.JobLauncherIntegrationTests.testLaunchAndRelaunch(JobLauncherIntegrationTests.java:41)
      1 frame
    5. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3 frames
    6. Spring TestContext
      SpringJUnit4ClassRunner.invokeTestMethod
      1. org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160)
      2. org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:233)
      3. org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
      4. org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
      5. org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
      6. org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
      7. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
      7 frames
    7. JUnit
      JUnit4ClassRunner.run
      1. org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
      2. org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
      3. org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
      4. org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
      5. org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
      5 frames
    8. Spring TestContext
      SpringJUnit4ClassRunner.run
      1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
      1 frame
    9. JUnit
      JUnitCore.run
      1. org.junit.runner.JUnitCore.run(JUnitCore.java:130)
      1 frame
    10. IntelliJ junit4 module
      JUnit4IdeaTestRunner.startRunnerWithArgs
      1. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
      1 frame
    11. IDEA
      JUnitStarter.main
      1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
      2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
      2 frames
    12. Java RT
      NativeMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2 frames
    13. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      1 frame