title: Hibernate H2 database not found
body: <p>I'm quite new to hibernate so my problem can be obvious to you. I created database in H2 Console with 3 tables (data.mv.db), insert some values and then copied it to my database folder in project path. Now I'm trying to read one of them for tests, but always have error that table not exists. I've tried to add properties to connection url like connection delay or not changing letter to upper case but still the same.</p>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Caused by: org.h2.jdbc.JdbcSQLException: Tabela "LOGIN_DATA" nie
    istnieje Table "LOGIN_DATA" not found; SQL statement: select
    login_data0_.ID as ID1_0_, login_data0_.USERNAME as USERNAME2_0_,
    login_data0_.PASSWORD as PASSWORD3_0_, login_data0_.FAVOURITE as
    FAVOURIT4_0_ from PUBLIC.LOGIN_DATA login_data0_ [42102-192]  at
    org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
      at org.h2.message.DbException.get(DbException.java:179)     at
    org.h2.message.DbException.get(DbException.java:155)  at
    org.h2.schema.Schema.getTableOrView(Schema.java:437)  at
    org.h2.command.Parser.readTableOrView(Parser.java:5371)   at
    org.h2.command.Parser.readTableFilter(Parser.java:1257)   at
    org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1896)     at
    org.h2.command.Parser.parseSelectSimple(Parser.java:2044)     at
    org.h2.command.Parser.parseSelectSub(Parser.java:1890)    at
    org.h2.command.Parser.parseSelectUnion(Parser.java:1709)  at
    org.h2.command.Parser.parseSelect(Parser.java:1697)   at
    org.h2.command.Parser.parsePrepared(Parser.java:445)  at
    org.h2.command.Parser.parse(Parser.java:317)  at
    org.h2.command.Parser.parse(Parser.java:289)  at
    org.h2.command.Parser.prepareCommand(Parser.java:254)     at
    org.h2.engine.Session.prepareLocal(Session.java:560)  at
    org.h2.engine.Session.prepareCommand(Session.java:501)    at
    org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1201)
      at
    org.h2.jdbc.JdbcPreparedStatement.(JdbcPreparedStatement.java:73)
      at
    org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:289)
      at
    org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:145)
      at
    org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:171)
      ... 17 more</p>
  </blockquote>
  
  <p>Hibernate Config:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  
  &lt;!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  
  &lt;hibernate-configuration&gt;
  
      &lt;session-factory&gt;
  
          &lt;!-- Database connection settings --&gt;
          &lt;property name="connection.driver_class"&gt;org.h2.Driver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:h2:file:~/database/data&lt;/property&gt;
          &lt;property name="connection.username"&gt;admin&lt;/property&gt;
          &lt;property name="connection.password"&gt;1234&lt;/property&gt;
  
          &lt;property name="hibernate.default_schema"&gt;PUBLIC&lt;/property&gt;
  
          &lt;!-- JDBC connection pool (use the built-in) --&gt;
          &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
  
          &lt;!-- SQL dialect --&gt;
          &lt;property name="dialect"&gt;org.hibernate.dialect.H2Dialect&lt;/property&gt;
  
          &lt;!-- Disable the second-level cache  --&gt;
          &lt;property name="cache.provider_class"&gt;org.hibernate.cache.internal.NoCacheProvider&lt;/property&gt;
  
          &lt;!-- Echo all executed SQL to stdout --&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
  
          &lt;mapping class="data.Login_data"/&gt;
      &lt;/session-factory&gt;
  
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>Login_data class:</p>
  
  <pre><code>@Entity
  @Table(name = "LOGIN_DATA")
  public class Login_data {
  
      private int id;
      private String name;
      private String password;
      private String values;
  
      public Login_data() {
          // this form used by Hibernate
      }
  
      public Login_data(int id, String name, String password, String values) {
          this.id = id;
          this.name = name;
          this.password = password;
          this.values = values;
      }
  
      @Id
      @GeneratedValue
      @Column(name = "ID")
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      @Column(name = "USERNAME")
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      @Column(name = "PASSWORD")
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      @Column(name = "FAVOURITE")
      public String getValues() {
          return values;
      }
  
      public void setValues(String values) {
          this.values = values;
      }
  }
  </code></pre>
  
  <p>Main class:</p>
  
  <pre><code>public static void main(String[] args){
              Login_data user = new Login_data();
              SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
              Session session = sessionFactory.openSession();
  
  
  
                  /*session.beginTransaction();
                  session.save(user);
                  session.getTransaction().commit();*/
  
                  // now lets pull events from the database and list them
                  session.beginTransaction();
                  List result = session.createQuery("from Login_data").list();
                  for (Login_data event : (List&lt;Login_data&gt;) result) {
                      System.out.println(event.getName());
                  }
                  System.out.print(result);
                  session.getTransaction().commit();
                  session.close();
  
          }
  </code></pre>
  
  <p>I've tried to edit configuration. So I add:</p>
  
  <pre><code> &lt;property name="hibernate.hbm2ddl.auto"&gt;update&lt;/property&gt;
  </code></pre>
  
  <p>And make empty database. What is strange is database and table created by Java after opening in H2 Console is not visible. So that can be the problem.
  I wanted to put a lot of data, so how to make it not from java to be visible there?</p>