<p>It looks like all the methods for loading SQLite involve loading from a named file using a string.  I would like to load SQlite database from memory.</p>

<p>The database is already loaded into memory.</p>

Use a special file name,
```
:memory:
```
```
```
sqlite3_open(":memory:", &db);
```
```
```
libsqlite
```
must have been compiled
without
```
SQLITE_OMIT_MEMORYDB
```
defined, as pointed out in
SQLite documentation
:
```
SQLITE_OMIT_MEMORYDB
```
When this is defined, the library does not respect the special database name
```
":memory:"
```
(normally used to create an in-memory database). If
```
":memory:"
```
is passed to
```
sqlite3_open()
```
,
```
sqlite3_open16()
```
, or
```
sqlite3_open_v2()
```
, a file with this name will be opened or created.
If you want to read the database that is
already
fully loaded into memory however, it will be more work. You will have to implement a custom VFS layer to operate on memory files and register it with your SQLite context.
See:
```
sqlite3_vfs
```
```
sqlite3_io_methods
```
I have not implemented it myself, so I can't reliably tell whether you have to implement the entire new VFS layer, or you can get away with substituting some functions in the default one (latter is unlikely).