简体   繁体   中英

Delphi FireDAC SQLite default database path in Windows 10

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? (ie 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.

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.

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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM