title: Can't query SQLite file located in read only directory
body: <p>I have a directory that contains the following files:</p>
  
  <pre><code>contacts.sqlite
  forms.sqlite
  locations.sqlite
  locations.sqlite-shm
  locations.sqlite-wal
  </code></pre>
  
  <p>I only have the following NTFS permissions on this directory:</p>
  
  <ul>
  <li>Read &amp; execute</li>
  <li>List folder contents</li>
  <li>Read</li>
  </ul>
  
  <p>When I'm trying to query those files with Java JDBC I'm getting different behavior:</p>
  
  <ul>
  <li><strong>contacts.sqlite</strong>: Exception - [SQLITE_CANTOPEN]  Unable to open the database file (unable to open database file)</li>
  <li><strong>forms.sqlite</strong>: I can query data successfully. </li>
  <li><strong>locations.sqlite</strong>: Expcetion - [SQLITE_IOERR_SHMOPEN]  I/O error within xShmMap while trying to open a new shared memory segment (disk I/O error)</li>
  </ul>
  
  <p>Here are some notes:</p>
  
  <ul>
  <li>There is only one database connection per file.</li>
  <li>The application that is using those files is closed/crashed.</li>
  <li>I can't delete or change files in original directory</li>
  <li>I can't change directory permission.</li>
  <li>I just need to query data, no need to insert any data.</li>
  <li>I tried to open those files with "DB Browser for SQLite" and I can only open "forms.sqlite" which is same case as Java JDBC.</li>
  </ul>
  
  <p>I tried the following:</p>
  
  <ul>
  <li>Copy files to directory with read/write permission and I was able to query them all.</li>
  <li>Set journal_mode to OFF: didn't help</li>
  <li>Set temp_store to memory: didn't help</li>
  <li>Open DB as read only: didn't help</li>
  </ul>
  
  <p>Edit:
  I'm using Xerial SQLite JDBC driver. I tried to open as read only and setting other paragma as following:</p>
  
  <pre><code>SQLiteConfig  config = new SQLiteConfig();
  config.setPragma(Pragma.JOURNAL_MODE, "OFF");
  //config.setOpenMode(SQLiteOpenMode.READONLY);
  config.setReadOnly(true);
  DriverManager.getConnection("data_base_url",
                      config.toProperties());
  </code></pre>
  
  <p>My question: is there a way to query those files while they are located in original directory without changing its permission? </p>