javainformixschemaspy

WARN - Failed to getImportedKeys The cursor has been previously released and is unavailable


I'm running SchemaSpy v6.1.0-SNAPSHOT on a fairly hefty Informix 12.10 schema, and I get the error "WARN - Failed to getImportedKeys The cursor has been previously released and is unavailable."

I know nothing about Java, but I've noticed a very similar error with Liquibase (also written in Java) and I wondered:

  1. whether anyone could advise me what causes this error and how I might avoid / work around it, given that I don't particularly want to learn Java :-)
  2. whether this is Informix-specific or is it also seen with other databases?

Solution

  • The liquidbase stack trace you had in How do I use --logLevel in Liquibase actually gives us a hint, but took me a while to work out what is likely happening. There we can see liquibase using a cached resultset. Caching ResultSets (cursors) are dangerous as the Informix JDBC driver does not hold cursors over commits. So there is a good chance that the software opened a resultset (cursor) did some other operation which caused Informix/JDBC to close the cursor, then it tried to use the already closed cursor which causes your error.

    There is an API to force JDBC to keep the cursors open: connection.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT)

    But I'm guessing you don't have an ability to affect this inside these products to try it. Informix sadly does not allow this setting to happen in the URL. A feature that should be added :)

    I tested against schemaspy against one of my databases (22 tables, 126 columns) with no issues with the latest Informix JDBC driver 4.10.JC12W1. The exact problem might be something that needs a reproduction for a support team to figure out for sure.