sqlite-jdbc
sqlite-jdbc copied to clipboard
sqlite3 java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state
I am using:
- sqlline-1.7.0-jar-with-dependencies.jar
- sqlite-jdbc-3.27.2.jar
I can connect to the database, create a table, select from the table, insert into the table, but the first time I try to read after an insert I get the following exception:
0: jdbc:sqlite:/maxmin> SELECT * FROM maxmind_build_specs ORDER by pdate DESC ;
java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state
at org.sqlite.core.CoreResultSet.checkCol(CoreResultSet.java:88)
at org.sqlite.jdbc3.JDBC3ResultSet.getTableName(JDBC3ResultSet.java:926)
at sqlline.Rows.isPrimaryKey(Rows.java:119)
at sqlline.TableOutputFormat.getOutputString(TableOutputFormat.java:114)
at sqlline.TableOutputFormat.getOutputString(TableOutputFormat.java:98)
at sqlline.TableOutputFormat.print(TableOutputFormat.java:40)
at sqlline.SqlLine.print(SqlLine.java:1626)
at sqlline.Commands.execute(Commands.java:982)
at sqlline.Commands.sql(Commands.java:906)
at sqlline.SqlLine.dispatch(SqlLine.java:740)
at sqlline.SqlLine.begin(SqlLine.java:557)
at sqlline.SqlLine.start(SqlLine.java:270)
at sqlline.SqlLine.main(SqlLine.java:201)
0: jdbc:sqlite:/maxmin>
Is anybody else experiencing the same problem?
I looked into the JDBC driver source code and found the following two code lines mentioned in the stack trace.
Sqlline is trying to get the tablename of the resultSet which results in the invocation of:
- https://github.com/xerial/sqlite-jdbc/blob/77ae7d2ddefe679fd0432eb0858bd8aab104b795/src/main/java/org/sqlite/jdbc3/JDBC3ResultSet.java#L926
Which in turn calls:
- https://github.com/xerial/sqlite-jdbc/blob/14839bae0ceedff805f9cda35f5e52db8c4eea88/src/main/java/org/sqlite/core/CoreResultSet.java#L86
Here we see, that colsMeta == null results in throwing the seen exception.
But how can colsMeta be null in a valid resultSet?
Does anybody have a deeper understanding how this can happen in the sqlite3 code?
Thanks for any help in advance on this matter.
Is this still happening on the latest version?
This error still happens: Exception in thread "main" java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state at org.sqlite.core.CoreResultSet.checkCol(CoreResultSet.java:95) at org.sqlite.jdbc3.JDBC3ResultSet.getColumnCount(JDBC3ResultSet.java:602) at java.sql.rowset/com.sun.rowset.CachedRowSetImpl.initMetaData(CachedRowSetImpl.java:728) at java.sql.rowset/com.sun.rowset.CachedRowSetImpl.populate(CachedRowSetImpl.java:652)
This error still happens: Exception in thread "main" java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state at org.sqlite.core.CoreResultSet.checkCol(CoreResultSet.java:95) at org.sqlite.jdbc3.JDBC3ResultSet.getColumnCount(JDBC3ResultSet.java:602) at java.sql.rowset/com.sun.rowset.CachedRowSetImpl.initMetaData(CachedRowSetImpl.java:728) at java.sql.rowset/com.sun.rowset.CachedRowSetImpl.populate(CachedRowSetImpl.java:652)
since you are not OP, can you clarify which version you use, and provide a repro maybe?