1
votes

I'm building a small app with a local in memory database using Delphi 10.3 with FireDAC set to SQLite. What is de default path to the database file that SQLite uses? (i.e. Database parameter is left blank)

I want to transfer the database file to another PC. I suppose it has the .db file extension, but I'm unable to locate the file.

2

2 Answers

1
votes

from http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_SQLite_with_FireDAC:

"To create and open an SQLite in-memory database use the following parameters:

DriverID=SQLite Database=:memory: Or just leave the Database parameter empty:"

This made me think that there should be a file that eventually stores the data, but it turns out there is none. All data is lost after the database is free'd.

1
votes

By definition "in memory" means no file. If you need a file for your data then add a filename (complete with path) to the Database value in TFDConnection's Params.

You can do it in the object inspector at design time or by code at run time it looks like:

FDConnection1.Params.Values['Database'] := 'C:\ProgramData\YourCompany\YourApp\YourFile.sqlite3';

Of course it is better to set the path by querying Windows for the location of "Program Data".