I am trying to build a DatabaseTable (my custom object) object by querying using jdbc DatabaseMetadata and ResultSet.
Below code works perfectly fine if I run it against MySQL database, but it fails with exception when tried against Exasol database.
private DatabaseTableColumnMetadata getTableAndColumnNames(DatabaseMetaData metaData)
throws SQLException {
ResultSet tables = metaData.getTables(null,null,"%",null);
while (tables.next()){
if (tables.getString("TABLE_TYPE").equalsIgnoreCase("TABLE")
&& ((ResultSetImpl) tables).getConnection().getCatalog()
.equals(tables.getString("TABLE_CAT"))) {
DatabaseTable table = DatabaseTable.builder().name(tables.getString("TABLE_NAME")).schema(tables.getString("TYPE_SCHEM")).build();
}
}
}
Exception thrown is as below
com.exasol.jdbc.EXAResultSet cannot be cast to com.mysql.cj.jdbc.result.ResultSetImpl","message":"com.exasol.jdbc.EXAResultSet cannot be cast to com.mysql.cj.jdbc.result.ResultSetImpl","name":"java.lang.ClassCastException
The exception thrown is at line where its trying to cast tables object to ResultSetImpl.
I have both jars in my project exajdbc.jar as well as mysql-connector.jar
Any help or clue to solve this problem pls.