title: H2 database console: how to connect to an embedded H2 JPA database?
body: <p>I have a couple of unit tests for an application's JPA layer. This JPA layer consists in JPA entities and a service providing the basic API required in order to persist the entities. The unit tets directly use the javax.persistence classes in order to handle the PersistenceManager. Then it tests the persistence API and I can see in the log the SQL statements to create tables and sequences, etc.</p>
  
  <p>The relevant part of the persistence.xml file looks like:</p>
  
  <pre><code>  &lt;persistence-unit name="..." transaction-type="RESOURCE_LOCAL"&gt;
    &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
    ...
    &lt;properties&gt;
      &lt;property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test"/&gt;
      &lt;property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/&gt;
      &lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/&gt;
      &lt;property name="hibernate.hbm2ddl.auto" value="create-drop"/&gt;
      &lt;property name="hibernate.format_sql" value="false"/&gt;
      &lt;property name="hibernate.show_sql" value="true"/&gt;
    &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  ...
  </code></pre>
  
  <p>I have downloaded H2 1.4.200, the Windows installer, and I installed it on Windows 10. Now using the H2 console I want to connect to the database and inspect the tables, sequences, etc. that were created automatically by Hibernate.</p>
  
  <p>So, going to <a href="http://localhost:8082" rel="nofollow noreferrer">http://localhost:8082</a> I get the following:</p>
  
  <p><a href="https://i.stack.imgur.com/7m91a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7m91a.png" alt="enter image description here"></a></p>
  
  <p>But when I try to connect to my database, using the defined JDBC connection string, I get the following:</p>
  
  <p><a href="https://i.stack.imgur.com/mpQEJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mpQEJ.png" alt="enter image description here"></a></p>
  
  <p>What am I doing wrong here ?</p>
  
  <p>Many thanks in advance.</p>
  
  <p>Nicolas</p>