title: Getting error "expected identifier" while using H2 Database for JUNIT Testing
body: <p>Am trying to write JUNIT Test cases for my SpringBoot Micro service. I used H2 Database. This is my test case -</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = DBSetUp.class)
  @SpringBootTest(classes = ClassToBeTested.class)
  public class ClassToBeTested{
  
  @Autowired
  private ClassToBeTested classToBeTested;
  
  @Test
  public void saveRandomTableTest(){
      Number number = null;
      RandomTableData randomTableData = new RandomTableData("XYZ", "XYZ WXY");
      number = classToBeTested.saveRandomTable(randomTableData );
      Assert.assertNotNull(number);
  }
  </code></pre>
  
  <p>The class(ClassToBeTested.class) am trying to test looks like this -</p>
  
  <pre><code>private static final String INSERT_RANDOMTABLE_SQL = "INSERT INTO RANDOM_USER.RANDOMTABLE VALUES ( RANDOM_USER.RANDOMTABLE_SEQ.nextval, ?, ?)";
  private static final String[] RANDOMTABLE_PRIMARY_KEY = {"RANDOMTABLE_ID"};
  
  public Number saveRandomTable(RandomTableData randomTableData ) {
      Number id = null;
      try{
          PreparedStatementCreator psc = new PreparedStatementCreator() {
              public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
                  PreparedStatement preparedStmt = connection.prepareStatement(INSERT_RANDOMTABLE_SQL, RANDOMTABLE_PRIMARY_KEY);
                  prepareStatement(preparedStmt, randomTableData);
                  return preparedStmt;
              }
          };
          KeyHolder keyHolder = new GeneratedKeyHolder();
          jdbcTemplate.update(psc, keyHolder);
          id = keyHolder.getKey();
      }catch(Exception e){
          LOGGER.error("Error is "+ e.getMessage());
      }
      return id;
  }
  </code></pre>
  
  <p>And DBSetUp.class looks like this -</p>
  
  <pre><code>CREATE SCHEMA IF NOT EXISTS "RANDOM_USER";
  CREATE SEQUENCE IF NOT EXISTS RANDOMTABLE_SEQ START WITH 1 INCREMENT BY 1;
  
  CREATE TABLE IF NOT EXISTS "RANDOM_USER"."RANDOMTABLE"(
  RANDOMTABLE_ID  NUMBER PRIMARY KEY,
  RANDOMTABLE_CODE VARCHAR2(50),
  RANDOMTABLE_NAME VARCHAR2(50)
  );  
  </code></pre>
  
  <p>But whenever am trying to getting like this in this JUNIT test case -</p>
  
  <pre><code>ERROR : bad SQL grammar []; nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error 
  in SQL statement "INSERT INTO RANDOM_USER.RANDOMTABLE VALUES ( RANDOM_USER.RANDOMTABLE_SEQ.nextval, 
  [*] ?, ?)"; expected "identifier"; SQL statement:INSERT INTO RANDOM_USER.RANDOMTABLE VALUES ( 
  RANDOM_USER.RANDOMTABLE_SEQ.nextval, ?, ?) [42001-200]
  </code></pre>
  
  <p>In actual this application is using Oracle DB. All the SQL quarries working fine for the application. Am only getting this error while using H2 DB for JUNIT Testing. Is there any particular syntax I need to add H2 DB? If yes then it needs work with Oracle as well.</p>