New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlite3 java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state #291
Comments
I think you should log a bug against SQLite. Please post the URL here. Maybe the SQLite developers can suggest a workaround. |
I looked a little bit more into the issue and it seems, that the SQLite JDBC driver throws this exception, when you try to access the Metadata of a ResultSet after you have iterated thru the result set. I found this solution (see Sqlite problem on OsX: inconsistent internal state. Help!):
The suggested solution is to make a copy of the needed metadata before using the resultSet. Could this be an issue here? If you can point me to some lines of code in sqlline that iterate thru a result set, I would check out the source code and try that solution. The JDBC standard really allows a resultSet to be closed and invalidated when next() returns false. So this may be a problem here? |
Can you provide evidence that the JDBC specification allows the result set to be closed by calling ‘next’? This is a bug in the SQLite driver. Let’s be clear about that. And please make sure a bug is logged. |
I looked at the oracle doc of java: There it says:
Of course there is room for interpretation ... |
It's pretty clear to me. The result set is not closed. You are free (subject to scrollability constraints) to re-position the result set on a valid row (say by calling |
I have posted the problem in the sqlite-users mailing list as suggested on their Bug Reports Page. Their bug tracking system is no longer open to the public, so I cannot post an URL. But I have taken the same subject for the post as in this issue. |
Seems to be a little hard to get a valid response from the sqllite mailing list ... they asked me if I had closed the db correctly ... but I think that is not the problem. I looked into the source code of the JDBC driver code following the stacktrace. It looks like we have a resultSet but no metainfo for the columns ... the variable colsMeta seems to be null ... strange ... I posted the following text to the sqllite mailing list, hoping somebody who knows the source code may respond:
|
How about posting an issue to https://github.com/xerial/sqlite-jdbc/issues? That seems to be the place, since this concerns the JDBC driver rather than SQLite itself. I did a quick scan and it does not seem that this issue is already logged. |
You are right. Got the same hint from the mailing list:
So I opened an issue in the sqlite JDBC project: |
I am using:
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 just found this on stackoverflow:
https://stackoverflow.com/questions/48269807/sqlite-jdbc-inconsistent-internal-state-when-attempting-to-getcolumncount-fro
But I don't know what to do.
Any help appreciated.
The text was updated successfully, but these errors were encountered: