title: Azure function read SQLite database
body: <p>From a third party I am receiving a SQLite '.db3' database file. I wish to read the data stored within the database in an Azure function, but have no requirement to modify the database.</p>
  
  <p>In my Azure function I have also uploaded a text file alongside the .db3 file, I can read the contents of this text file just fine, meaning that I have the URI and read privileges on the folder.</p>
  
  <p>When I try to read some data from the database I get the error 'database is locked'.</p>
  
  <p>Code to read the database is below. This works locally.</p>
  
  <pre><code>List&lt;object&gt; obs = new List&lt;object&gt;();
  using(var con = new SQLiteConnection($"URI=file:{fullUri};mode=ReadOnly"))
  {
      con.Open();
      using(var cmd = new SQLiteCommand(sql, con))
      {
          using(SQLiteDataReader rdr = cmd.ExecuteReader())
          {
              while(rdr.Read())
              {
                  obs.Add(rdr.GetValues());
              }
          }
      }
      con.Close();
  }
  return obs;
  </code></pre>
  
  <p>How do I read the database?</p>