MSSQL issue: The incoming request has too many parameters
Symptoms
Go to the “Overview“ report.
Open the “Filters“ inline dialog and apply a CQL filter that returns more than 2100 content units as a result. It might be a space with more than 2100 pages and blog posts.
Your report is empty, and you see errors in the browser console:
An error message appears:The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request.
Workaround
Define more specific CQL in the filter.
Possible cause
Viewtracker users who use Confluence with an MSSQL database and use a CQL filter on the “Overview“ report might see errors in the Confluence log like:
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:260)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1547)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:528)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:461)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7342)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2688)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:224)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:204)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:383)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:1471)
at com.querydsl.sql.AbstractSQLQuery.unsafeCount(AbstractSQLQuery.java:616)
... 350 more
The error is specific for the MSSQL database.
The cause of this error: the user specified a CQL filter that is too general, i.e., the CQL filter returns more than 2100 results.
Resolution
To fix this error, you have to enable this dark feature:
bv.viewtracker.sql.query.literals.enabled
and apply the filter in the report afterward. After this change, your report should work normally.