SQLite JDBC error: [SQLITE_ERROR] SQL error or missing database (no such table:)
45 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to read data from a .db file. This file has a colume of blob data type that cannot be read by function sqlite.
So I switch to Matlab SQLite JDBC database interface with the following steps.
(1) I download the sqlite-jdbc-3.7.2.jar and add it to javaclasspath.txt. (I'm using R2016a)
(2) Set up a JDBC connection in Matlab-Apps-Databse explorer, and type in the flollowing information as required.
Select "Other"
Name: SQLite
username: [nothing]
password: [nothing]
driver:org.sqlite.JDBC
url:jdbc:sqlite:D:\QMDownload\9\uhistory3-20160926.db
I run the test and it shows sucessful.
(3) Then I run the commands:
datasource = 'SQLite';
username = '';password = '';
driver = 'org.sqlite.JDBC';
url = 'jdbc:sqlite:D:\QMDownload\9\uhistory3-20160926.db';
conn = database(datasource,username,password,driver,url)
database with properties:
Instance: 'SQLite'
UserName: ''
Driver: 'org.sqlite.JDBC'
URL: 'jdbc:sqlite:D:\QMDownload\9\uhistory3-20160926.db'
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: []
Handle: [1x1 org.sqlite.Conn]
TimeOut: 0
AutoCommit: 'on'
Type: 'Database Object'
(4) Then I read the table:
aCmd = ['SELECT * FROM tb_urlinfo'];
curs = exec(conn,aCmd);
data = fetch(curs,rowlimit);
It always shows an error:
Error using database/exec (line 54)
[SQLITE_ERROR] SQL error or missing database (no such table: tb_urlinfo).
I have tried many other db files, but it always shows the same error.
I also tried in R2017a, and the error is the same. Can anyone help me? Thanks
5 comentarios
Rik
el 11 de Ag. de 2020
I had two reasons for creating the sqlite3 FEX submission:
- I wanted full compatibilty with GNU Octave and Matlab 6.5 for a specific function I'm expanding
- I don't have access to the database toolbox
So I can't really help you with the native Matlab command not working as you want it to.
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!