sqlite3 java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlite3 java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state

Frank Kemmer
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>

Does anybody else have the same problem?

Are there any known work arounds or fixes?

Any help appreciated.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3 java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state

Simon Slavin-3
On 27 Apr 2019, at 10:47am, Frank Kemmer <[hidden email]> wrote:

> 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:

Are you checking the result codes from all these operations ?

If you close the database without trying to read it, then use the SQLite shell tool to read it, is your row there ?

If, in your software, you close the database without trying to read it, then reopen it, then try reading it, do you get the same error ?
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3 java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state

Frank Kemmer
Simon Slavin <[hidden email]> schrieb am Sa. 27. Apr. 2019 um 14:28:

> On 27 Apr 2019, at 10:47am, Frank Kemmer <[hidden email]> wrote:
>
> > 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:
>
> >> Are you checking the result codes from all these operations ?


All these operations happen on one connection in one session. My first
operation is to list the tables and then I do the select.

When I insert the lines with the sqlite3 command line tool everything is
fine. But when I use sqlline with the sqlite JDBC Driver, I get this
exception with the first select statement.

I can even insert the lines with sqlline and select them in sqlite3 ... but
I can‘t do a select in sqlline. This results in the exception given above.

It reminds me on the problem that after the iteration over the resultSet,
the resultSet was closed and you no longer could access the metadata ...
but I am just guessing here.

> --
Wir ertrinken in Information, aber hungern nach Wissen [John Naisbitt]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3 java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state

Frank Kemmer
In reply to this post by Frank Kemmer
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.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3 java.lang.IllegalStateException: SQLite JDBC: inconsistent internal state

Rowan Worth-2
On Wed, 1 May 2019 at 19:30, Frank Kemmer <[hidden email]> wrote:

>
> 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?
>

This has nothing to do with the sqlite3 code itself but judging by the
comments in the jdbc binding, colsMeta being null implies that the
ResultSet has been closed. But I'm not sure where colsMeta is initialised,
it appears some other class is responsible for that.

-Rowan
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users