title: Setup H2 in Server Mode using Java Based Configuration
body: <p>I have spring XML that enables me to start H2 database in server mode using the following configuration:</p>
  
  <pre><code>&lt;beans profile="test-h2"&gt;
      &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
            destroy-method="close"&gt;
          &lt;property name="driverClassName" value="org.h2.Driver"/&gt;
          &lt;property name="url" value="jdbc:h2:target/h2/pps;AUTO_SERVER=TRUE"/&gt;
          &lt;property name="username" value="sa"/&gt;
          &lt;property name="password" value=""/&gt;
      &lt;/bean&gt;
      &lt;bean id="entityManagerFactory" parent="entityManagerFactoryCommonParent"&gt;
          &lt;property name="jpaProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.hbm2ddl.auto"&gt;create-drop&lt;/prop&gt;
                  &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>I want to convert to java based configuration. I have seem a post here: <a href="https://stackoverflow.com/questions/4671102/start-and-setup-in-memory-db-using-spring">Start and setup in-memory DB using Spring</a> asking somewhat the same question and I have looked at <a href="http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-embedded-database-support" rel="nofollow noreferrer">http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-embedded-database-support</a> for Embedded Database but it does not say how to set H2 mode to Server mode. It is starting the server for me in "mem" mode only.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
  
  builder.setType(EmbeddedDatabaseType.H2);
  builder.setName(DATABASE_NAME);
  builder.addScript(H2_SCHEMA);
  builder.addScript(H2_TEST);
  return builder.build();
  </code></pre>
  
  <p>Maybe using EmbeddedDatabaseBuilder(ResourceLoader) might work. Does anyone has some sample code for it?</p>