sqlite ignore project path?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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")
0 comentarios
Respuesta aceptada
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)
Ver también
Categorías
Más información sobre Database Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!