[MDEV-11150] CONNECT engine table_type=JDBC handling case of rc=-1 Created: 2016-10-26  Updated: 2016-12-15  Resolved: 2016-12-15

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Connect
Affects Version/s: 10.1.18
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Robert Dyas Assignee: Olivier Bertrand
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

centOS 7



 Description   

It appears certain JDBC drivers will return a row count of -1 when they are uncertain how many rows will be retrieved. CONNECT doesn't seem to like this and generates an error:

Error Code: 1296. Got error 174 'Cannot get result size rc=-1' from CONNECT

Is it possible for CONNECT to just retrieve all available rows under this condition?



 Comments   
Comment by Olivier Bertrand [ 2016-11-03 ]

This did not happen to me yet. Can you elaborate and tell what drivers on what circumstances return this value?

Comment by Robert Dyas [ 2016-11-03 ]

After having tracked this down with the driver vendor (CData Google Apps driver) it appears that certain drivers that are fronting APIs and not databases cannot do a count.

I don't know how many of the many drivers we might try to deploy soon have this limitation. If it is possible and reasonable to do so, could CONNECT look for and trap this exception and then proceed with row count unknown in these cases?

Comment by Olivier Bertrand [ 2016-11-14 ]

Can you describe when this can occur. Is it when doing a:

select count(*) from a_table;

Or when executing other queries? (which)

Generally speaking, when reporting a bug, try to give all information needed to trace what happen. Just telling a bug occur does not often make possible to fix it.

Comment by Robert Dyas [ 2016-11-14 ]

I apologize for the lack of info here. It appears that certain JDBC drivers that are build on top of APIs rather than SQL databases may NOT be able to do a simple count (as in example below) for whatever reason.

select count(*) from a_table;

If there is an easy work around for CONNECT to gracefully accept drivers with this limitation, that would be helpful. If not, we just won't be able to use those until the driver vendor provides a fix (sometime in Q2 2017 it appears).

Comment by Olivier Bertrand [ 2016-11-15 ]

CONNECT does not make the difference between select statements and just send them, after updating the table name, to the JDBC driver by executeQuery. This function normally returns the number of columns of the result set and a negative number means an error.
I does not see how a driver could return -1 as the column number of a

select count(*) from a_table

query. I would rather think that the number of rows could be returned as -1 but in that case there would be no error for CONNECT.
If it really returns -1 as the column number, this is clearly a bug of the driver, not of CONNECT and you should report it to the driver team.

Comment by Robert Dyas [ 2016-11-15 ]

It looks like rc = -1 so assumed (incorrectly?) that it was row count.
I thought CONNECT might be issuing its own SELECT count FROM some_table and if the number was less than 0 saw it as an error.

This is occurring with the CData driver for Google Apps - available for free 30 day trial download if you want. It might be their driver... just no way of me knowing.

Comment by Robert Dyas [ 2016-12-15 ]

I think this bug report can be closed for now.
This appears to be a limitation of a CData driver that can't understand select count from sometable so really isn't a bug on the CONNECT side of things.

Comment by Olivier Bertrand [ 2016-12-15 ]

See last Robert Dyas comment.

Generated at Thu Feb 08 07:47:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.