Borrar filtros
Borrar filtros

sqlite ignore project path?

3 visualizaciones (últimos 30 días)
Simon
Simon el 14 de Mayo de 2024
Comentada: Simon el 21 de Mayo de 2024
I have a sqlite database, say "filename.db", in a local folder (MacOS). The folder is then added to my project path. However, sqlite can find it with absolute path, but not with filename. Can sqlite not search in the project path?
% works
conn = sqlite(full_absolute_path/"filename.db", "connect")
% Error: database not found
conn = sqlite("filename.db", "connect")

Respuesta aceptada

Saurabh
Saurabh el 21 de Mayo de 2024
Hi Simon,
I understand that you have added your folder to the MATLAB path and want to know if 'SQLite’ function can search on the project path or not.
'SQLite' does not automatically search within project or MATLAB’s path for database files. Instead, it relies on either an absolute path or a path relative to the current working directory (Where the MATLAB session or script is running from) to locate the database file.
When just provided with filename like ‘filename.db’, 'SQLite' function interprets it as being in the current working directory. If the file is not in the current working directory, an error will be encountered stating that database is not found. To address this issue, either use an absolute path:
conn = sqlite("/full/absolute/path/filename.db", "connect");
or use a relative path that is if the database file is in a known location relative to the current working directory from which your MATLAB code is being executed:
conn = sqlite("./relative/path/to/filename.db", "connect");
For More information on SQLite function leverage the link below:
I hope this was helpful.

Más respuestas (0)

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by