필터 지우기
필터 지우기

sqlite ignore project path?

조회 수: 3 (최근 30일)
Simon
Simon 2024년 5월 14일
댓글: Simon 2024년 5월 21일
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")

채택된 답변

Saurabh
Saurabh 2024년 5월 21일
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.
  댓글 수: 1
Simon
Simon 2024년 5월 21일
very helpful, thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by