Compatibility H2 1.4.194 vs 1.4.197

390 views
Skip to first unread message

goran....@gmail.com

unread,
May 28, 2018, 11:10:22 AM5/28/18
to h2-da...@googlegroups.com

Hi there!

 

Should the H2 JDBC Driver be backward compatible?

 

I have the following issue when using JDBC Driver H2 1.4.197 and connecting to a database created with 1.4.194

 

conn.getMetaData().getTables(null, null, "%", null);

 

Causes:

org.h2.jdbc.JdbcSQLException: Table "SYNONYMS" not found; SQL statement: SELECT TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS, TYPE_CAT, TYPE_SCHEM, TYPE_NAME, SELF_REFERENCING_COL_NAME, REF_GENERATION, SQL FROM (SELECT SYNONYM_CATALOG TABLE_CAT, SYNONYM_SCHEMA TABLE_SCHEM, SYNONYM_NAME as TABLE_NAME, TYPE_NAME AS TABLE_TYPE, REMARKS, TYPE_NAME TYPE_CAT, TYPE_NAME TYPE_SCHEM, TYPE_NAME AS TYPE_NAME, TYPE_NAME SELF_REFERENCING_COL_NAME, TYPE_NAME REF_GENERATION, NULL AS SQL FROM INFORMATION_SCHEMA.SYNONYMS WHERE SYNONYM_CATALOG LIKE ? ESCAPE ? AND SYNONYM_SCHEMA LIKE ? ESCAPE ? AND SYNONYM_NAME LIKE ? ESCAPE ? AND (true)  UNION SELECT TABLE_CATALOG TABLE_CAT, TABLE_SCHEMA TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS, TYPE_NAME TYPE_CAT, TYPE_NAME TYPE_SCHEM, TYPE_NAME, TYPE_NAME SELF_REFERENCING_COL_NAME, TYPE_NAME REF_GENERATION, SQL FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG LIKE ? ESCAPE ? AND TABLE_SCHEMA LIKE ? ESCAPE ? AND TABLE_NAME LIKE ? ESCAPE ? AND (TRUE) ) ORDER BY TABLE_TYPE, TABLE_SCHEM, TABLE_NAME [42102-197]

 

I guess this has to do with: http://www.h2database.com/html/changelog.html

  • PR #568: Implement MetaData.getColumns() for synonyms.

 

My guess is that the JDBC Driver should be version independent, at least when it comes to MetaData information, meaning:

  • The driver checks with what H2 version it has connected to and tries to be as compatible as possible
    In this specific case, do not select on the table SYNONYMS, since it has been added in a later H2 version

 

Here is the “create” information from: INFORMATION_SCHEMA.SETTINGS

1> select * from INFORMATION_SCHEMA.SETTINGS where name like '%BUILD%' or name like '%VERSION%'

+------------------+--------------------+

|NAME              |VALUE               |

+------------------+--------------------+

|CREATE_BUILD      |194                 |

|info.BUILD_ID     |194                 |

|info.VERSION_MAJOR|1                   |

|info.VERSION_MINOR|4                   |

|info.VERSION      |1.4.194 (2017-03-10)|

+------------------+--------------------+

(5 rows affected)

 

Is this a known issue/limitation or is it a new one?

/Goran Schwarz

 

Evgenij Ryazanov

unread,
May 28, 2018, 11:32:44 PM5/28/18
to H2 Database
Hello.

Do you use 1.4.194 server and 1.4.197 client?

This is a known regression in 1.4.197 that was already fixed, the fix will be included in the next release. You can upgrade your database server to the 1.4.197, this should resolve your problem or downgrade client driver to 1.4.196 or to an older version.

Also you can build client driver from the current sources from the GitHub or wait for a next release that should be compatible with older servers.

goran....@gmail.com

unread,
May 29, 2018, 4:06:51 AM5/29/18
to h2-da...@googlegroups.com

> Do you use 1.4.194 server and 1.4.197 client?

Correct!

 

> This is a known regression in 1.4.197 that was already fixed

Thanks

 

/Goran

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages