title: Spring boot application not able to detect table defined in sqlite db file
body: <p>I have a Spring boot application which uses SQLite db to perform CRUD operations. When I try to insert a row into the database, I always get this error. I want to be able to perform CRUD operations with the sqlite db. My stack trace is given below</p>
  
  <pre><code>org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: Chats)
      at org.sqlite.core.DB.newSQLException(DB.java:909) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.core.DB.newSQLException(DB.java:921) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.core.DB.throwex(DB.java:886) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.core.NativeDB.prepare_utf8(Native Method) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.core.NativeDB.prepare(NativeDB.java:127) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.core.DB.prepare(DB.java:227) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.core.CorePreparedStatement.&lt;init&gt;(CorePreparedStatement.java:41) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.jdbc3.JDBC3PreparedStatement.&lt;init&gt;(JDBC3PreparedStatement.java:30) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.jdbc4.JDBC4PreparedStatement.&lt;init&gt;(JDBC4PreparedStatement.java:19) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:48) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:254) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:226) ~[sqlite-jdbc-3.15.1.jar:na]
      at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1524) ~[spring-jdbc-4.3.12.RELEASE.jar:4.3.12.RELEASE]
  ... 
  </code></pre>
  
  <p>This is not correct because I am able to see the DDL of the table being created in SQLite client in the file. </p>
  
  <p><a href="https://i.stack.imgur.com/gH4Ou.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gH4Ou.png" alt="Chats DDL"></a></p>
  
  <p>The SQLite db file is located at <code>src/main/resources/mydb.db</code>loction in the maven project. I tried the following configuration in my application properties.</p>
  
  <pre><code>spring.datasource.url=jdbc:sqlite:mydb.db
  spring.datasource.driver-class-name=org.sqlite.JDBC
  spring.jpa.database-platform=com.myproject.assignment.SqliteDialect
  spring.datasource.username=
  spring.datasource.password=
  spring.jpa.hibernate.ddl-auto=create
  spring.jpa.show-sql=true
  </code></pre>
  
  <p>The configuration for the dialect has been taken from the following SO posts</p>
  
  <ol>
  <li><p><a href="https://stackoverflow.com/questions/42890375/spring-boot-configure-sqlite-database">spring boot: configure Sqlite database</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/24232892/spring-boot-and-sqlite">Spring boot and SQLite</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/33197230/resources-in-a-spring-boot-application-are-missing-from-jar-file-when-using-spri">resources in a Spring Boot application are missing from jar file when using Spring Boot Maven Plugin</a></p></li>
  </ol>
  
  <p>Here is the method to insert code into the database.</p>
  
  <pre><code>public long insertChatRecord(final ChatRecord chatRecord) {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Inserting chat record: " + chatRecord);
      }
      DateTime dateTime = DateTime.now().withZone(DateTimeZone.UTC);
      DateTime expirationTime = dateTime.plusSeconds(
          chatRecord.getTimeout() != null ? chatRecord.getTimeout().intValue(): 60);
      final String timestamp = expirationTime.toString(TIMESTAMP_FORMAT);
      long chatId = SequenceGenerator.getInstance().next();
      chatRecord.setChatId(chatId);
      chatRecord.setExpirationTimestamp(expirationTime);
      StringBuilder sb = new StringBuilder();
      sb.append("INSERT INTO Chats(chat_id, username, chat_text, expiration_date) ");
      sb.append("VALUES(?, ?, ?, ?)");
      jdbcTemplate.update(sb.toString(), new PreparedStatementSetter() {
  
        @Override
        public void setValues(PreparedStatement ps)
            throws SQLException, DataAccessException {
          // TODO Auto-generated method stub
          ps.setLong(1, chatRecord.getChatId());
          ps.setString(2,  chatRecord.getUsername());
          ps.setString(3,  chatRecord.getText());
          ps.setString(4, timestamp);
        }});
      return chatId;
    }
  </code></pre>
  
  <p>The exception is raised at this particular line.</p>
  
  <pre><code>jdbcTemplate.update(sb.toString(), new PreparedStatementSetter() {
  
        @Override
        public void setValues(PreparedStatement ps)
            throws SQLException, DataAccessException {
          // Setting values for prepared statement.
        }});
  </code></pre>
  
  <p>I don't know what I am doing wrong. I am running Spring Boot app in Eclipse. The main class is given below:</p>
  
  <pre><code>@SpringBootApplication
  public  class Application {
  
    public static void main(String[] args) throws Exception {
      SpringApplication.run(Application.class, args);
    }
  
  }
  </code></pre>
  
  <p>My pom.xml configuration as <a href="https://docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html" rel="nofollow noreferrer">suggested by plugin documentation</a> is given below.</p>
  
  <pre><code>&lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;addResources&gt;true&lt;/addResources&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  </code></pre>