-
Notifications
You must be signed in to change notification settings - Fork 232
Description
Describe the bug
When querying the database for all available tables through the Comdb2MetaData object in cdb2jdbc, if the database version is also queried, it breaks and is unable to find the tables after. Not sure if this is intended behavior
To Reproduce
Here is an example test case that reproduces the issue
https://gist.github.com/jeffrytyn/50403cb3b74dcdb8457aa537d771b6e0
Expected behavior
I expect the test to pass but it fails
Additional context
Looking inside the Comdb2MetaData class, it has instance variables ps and stmt.
ps is creating inside getTables method from the conn object
stmt is created in the constructor of the class using the same conn object
This conn object itself has an instance variable hndl
The ResultSet tables is the output of ps.executeQuery, where ps is a Comdb2PreparedStatement created with hndl.
version is the output of stmt.executeQuery, where stmt is a Comdb2Statement created with hndl also
tables.next() invokes hndl.next(), but because the same hndl was used to get the version, it now returns false instead of true. Seems like different hndls should be used