MATLAB7 + sqlitejdbc-v056.jar 访问数据库
以下代码出错:
conn=database('data.db','','','org.sqlite.JDBC','jdbc:sqlite:C:/MATLAB7/work/del_man_voice_from_wave/data.db'); % ping(conn); % set(conn,'AutoCommit','off'); exec(conn, 'create table mytst(id, name, score1, score2)'); exec(conn, 'insert into mytst values(1,"zhangsan",88.5,90)'); exec(conn, 'insert into mytst values(2,"lisi",98.5,92);'); curs=exec(conn,'select id,name from mytst') disp aa curs=fetch(curs); % commit(conn);
??? Java exception occurred: java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state at org.sqlite.RS.checkCol(RS.java:62) at org.sqlite.RS.getColumnCount(RS.java:319) at com.mathworks.toolbox.database.fetchTheData.maximumColumns(fetchTheData.java:174) . Error in ==> cursor.cols at 50 columns = double(maximumColumns(cursor.Fetch,resultSetMetaData)); Error in ==> cursor.fetch at 120 numberOfColumns = double(cols(cursor)); Error in ==> test_sqlite at 9 curs=fetch(curs);
解决的方法: