title: Why is java.sql.DriverManager.getConnection() still working after removing the SQLite database JAR?
body: <p>I'm having difficulties in Java with an SQLITE database provided in a separate JAR file.
  Surprisingly, <strong>the sqlite database seems to be accessed even after removing the JAR file, exiting and restarting the program</strong> and even after rebooting the machine.</p>
  
  <p>I'm using the Xerial driver <code>sqlite-jdbc-3.7.2.jar</code> (for <code>org.sqlite.JDBC</code>).<br/>
  <strong>EDIT:</strong> very same issue with <code>sqlite-jdbc-3.8.6.jar</code>.
  Xerial JDBC driver is published here:
  <a href="https://bitbucket.org/xerial/sqlite-jdbc" rel="nofollow">https://bitbucket.org/xerial/sqlite-jdbc</a></p>
  
  <p>I'm really puzzled. Is there some kind of persistent cache for this particular JDBC driver? or is it something I missed regarding JDBC in general?</p>
  
  <p><strong>CODE SAMPLE:</strong></p>
  
  <pre><code>import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  
  public class SqliteJDBCTest {
  
      public static void main(String[] args) {
          Connection connection = null;
          Statement statement = null;
          ResultSet rs = null;
          try {
              Class.forName("org.sqlite.JDBC");
              connection = DriverManager.getConnection("jdbc:sqlite::resource:jar:file:doesntexistJAR.jar!/doesntexistDB.sqlite");
              System.out.println("connection = " + connection);
  
              statement = connection.createStatement();
              System.out.println("statement = " + statement);
              rs = statement.executeQuery(" SELECT * FROM nonexistentTable WHERE key = 'nonexistentKey'");
          } catch (Exception e) {
              e.printStackTrace();
          } finally {
              if (connection != null) {
                  try {
                      connection.close();
                  } catch (SQLException e) {
                      e.printStackTrace();
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>The above code sample shows the first step of the problem: on the first run, <code>DriverManager.getConnection(..)</code> throwed an exception as expected:</p>
  
  <pre><code>$ java -jar sqliteJDBCTest.jar 
  java.sql.SQLException: failed to load jar:file:doesntexistJAR.jar!/doesntexistDB.sqlite: java.io.FileNotFoundException: doesntexistJAR.jar (Aucun fichier ou dossier de ce type)
      at org.sqlite.Conn.open(Conn.java:92)
      at org.sqlite.Conn.&lt;init&gt;(Conn.java:57)
      at org.sqlite.JDBC.createConnection(JDBC.java:77)
      at org.sqlite.JDBC.connect(JDBC.java:64)
      at java.sql.DriverManager.getConnection(DriverManager.java:664)
      at java.sql.DriverManager.getConnection(DriverManager.java:270)
      at SqliteJDBCTest.main(SqliteJDBCTest.java:18)
  </code></pre>
  
  <p>But, since then, for each run I get the following output:</p>
  
  <pre><code>&gt;java -jar sqliteJDBCTest.jar
      connection = org.sqlite.Conn@3fee733d
      statement = org.sqlite.Stmt@5acf9800
      java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: nonexistentTable)
              at org.sqlite.DB.newSQLException(DB.java:383)
              at org.sqlite.DB.newSQLException(DB.java:387)
              at org.sqlite.DB.throwex(DB.java:374)
              at org.sqlite.NativeDB.prepare(Native Method)
              at org.sqlite.DB.prepare(DB.java:123)
              at org.sqlite.Stmt.executeQuery(Stmt.java:121)
              at SqliteJDBCTest.main(SqliteJDBCTest.java:23)
  </code></pre>
  
  <p>In this example, the <code>SQLException</code> "SQL error or missing database" is not the error we're expecting!</p>
  
  <p>Not only is the database missing, but even the JAR file supposed to contain it!
  So how come <code>getConnection()</code> doesn't throw an exception in the first place?</p>