title: Set H2 schema on connection
body: <p>I am configuring an h2 test database for our oracle production database. All tables are of the schema <code>xxx</code>. My datasource is defined as below:</p>
  
  <pre><code>public DataSource dataSource() {
      JdbcDataSource ds = new JdbcDataSource();
      ds.setUrl("jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MODE=Oracle;TRACE_LEVEL_SYSTEM_OUT=2;INIT=CREATE SCHEMA IF NOT EXISTS xxx;SCHEMA=xxx");
      ds.setUser("xxx");
      ds.setPassword("xxx");
      return ds;
  }
  </code></pre>
  
  <p>With <code>SCHEMA=xxx</code>, I get an error: <code>Caused by: org.h2.jdbc.JdbcSQLException: Schema "xxx" not found; SQL statement: SET SCHEMA xxx [90079-186]</code></p>
  
  <p>Without <code>SCHEMA=xxx</code>, I get errors whenever Hibernate attempts to run a query with a join because it does not prepend the schema to the table name. It does this in production with our oracle database though.</p>
  
  <p>Edit:
  To provide some more insight, I am populating my db from creation scripts that are also used in production:</p>
  
  <pre><code>@Bean
  public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {
      final DataSourceInitializer initializer = new DataSourceInitializer();
      initializer.setDataSource(dataSource);
      initializer.setDatabasePopulator(databasePopulator());
      return initializer;
  }
  
  private DatabasePopulator databasePopulator() {
      final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
      populator.setSeparator(";");
      populator.setCommentPrefix("--");
      populator.addScript(new ClassPathResource("db-schema.sql"));
      populator.addScript(new ClassPathResource("db-init-data.sql"));
      return populator;
  }
  </code></pre>