title: SQLITE_ERROR SQL error or missing database (no such table:users)
body: <p>hope someone can help. I am trying to access my database from a Dynamic Web project in Eclipse. For some reason I keep receiving the following error:</p>
  
  <p>[SQLITE_ERROR] SQL error or missing database (no such table: users)</p>
  
  <p>There definitely is a table called 'users' in the books database. I think it could be to do with where I am saving the the database since I know the code I've used works fine because I have used it in another part of my project. Screen shot below to show where things are saved. My database is in both the main directory and the web inf directory because my main program needs access to it as well as the server.  </p>
  
  <p><a href="https://i.stack.imgur.com/vX2qA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vX2qA.png" alt="enter image description here"></a> </p>
  
  <p>My code:  </p>
  
  <pre><code>public class Authentication {
  
      private static Connection getDBConnection() {
  
          Connection conn = null;
  
          try {
              Class.forName("org.sqlite.JDBC");
          } catch (ClassNotFoundException e) {
              System.out.println(e.getMessage());
          }
  
          try {
              String url = "jdbc:sqlite:books.sqlite";
              //Gets connection with the JDBC API
              conn = DriverManager.getConnection(url);
          } catch (SQLException e) {
              System.out.println(e.getMessage());
          }
  
          return conn;
      }
  
      public String authenticate(String username, String password) throws SQLException {
  
          // TODO maybe removed this line below or change it. 
  
                  Statement statement = null;
                  Connection conn = null;
                  ResultSet results = null;
                  HashMap&lt;String,String&gt; userPass = new HashMap&lt;String,String&gt;();
  
                  // Creates SQL query and adds it to String variable.
                  String query = "SELECT username, password FROM users";
                  // TODO Maybe remove the below line, not necessary?
                  // Book temp = null;
  
                  try {                       
                      conn = getDBConnection();   
                      statement = conn.createStatement();                     
                      results = statement.executeQuery(query);                    
                      while (results.next()) {                        
                          String Username = results.getString("username");
                          String Password = results.getString("password");                            
                          userPass.put(Username, Password);
                      }
                  } finally {
                      if (results != null)
                          results.close();
                      if (statement != null)
                          statement.close();
                      if (conn != null)
                          conn.close();
                  }
                  //Returns to newly created bookList to where the method was called.
  
                  if (userPass.get(username)== password ) {
                      return "success";
                  }
                  else {
                      return "error";
                  }               
      }
  }
  </code></pre>