SqlExceptionHelper: Cursors are not supported on a

2019-08-11 06:13发布

问题:

I'm trying to import data from DWH SQL server table which is using Clustered Columnstore Index into kudu through flume. However, after my custom flume source retrieves a certain number of rows from the database, this exception occurs:

SqlExceptionHelper: Cursors are not supported on a table which has a clustered columnstore index

I'm using JDBC SQL Server driver type 4, and apparently it uses cursors to iterate resultset. Therefore, I tried setting fetch size to the number the query is limited to, but nothing changed.

How can I stop the JDBC driver from using cursors and thus get all rows imported into a kudu table?

Thanks in advance.

回答1:

Try setting selectmethod=direct in the connection properties. Source:

If set to direct (the default), the database server sends the complete result set in a single response to the driver when responding to a query. A server-side database cursor is not created if the requested result set type is a forward-only result set. Typically, responses are not cached by the driver. Using this method, the driver must process the entire response to a query before another query is submitted. If another query is submitted (using a different statement on the same connection, for example), the driver caches the response to the first query before submitting the second query. Typically, the Direct method performs better than the Cursor method.

Of course you need to define your resultset as FORWARD_ONLY to guarantee this.