[ 
https://issues.apache.org/jira/browse/OAK-3843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tomek Rękawek updated OAK-3843:
-------------------------------
    Description: 
Following exception is thrown if the {{RDBDocumentStoreJDBC.read()}} method is 
called with more than 2100 keys:

{noformat}
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:216)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
 ~[sqljdbc4.jar:na]
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) 
~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
 ~[sqljdbc4.jar:na]
        at 
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStoreJDBC.read(RDBDocumentStoreJDBC.java:593)
 ~[oak-run-1.4-SNAPSHOT.jar:1.4-SNAPSHOT]
        at 
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.readDocumentsUncached(RDBDocumentStore.java:387)
 [oak-run-1.4-SNAPSHOT.jar:1.4-SNAPSHOT]
{noformat}

The parameters are already split into multiple {{in}} clauses, so I think we 
need to split it further, into multiple queries (if the MS SQL is used). This 
also applied to other places where we use the 
{{RDBJDBCTools.createInStatement()}}.

  was:
Following exception is thrown if the {{RDBDocumentStoreJDBC.read()}} method is 
called with more than 2100 keys:

{noformat}
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:216)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
 ~[sqljdbc4.jar:na]
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) 
~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
 ~[sqljdbc4.jar:na]
        at 
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
 ~[sqljdbc4.jar:na]
        at 
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStoreJDBC.read(RDBDocumentStoreJDBC.java:593)
 ~[oak-run-1.4-SNAPSHOT.jar:1.4-SNAPSHOT]
        at 
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.readDocumentsUncached(RDBDocumentStore.java:387)
 [oak-run-1.4-SNAPSHOT.jar:1.4-SNAPSHOT]
{noformat}

The parameters are already split into multiple {{in}} clauses, so I think we 
need to split it further, into multiple queries in one batch (if the MS SQL is 
used). This also applied to other places where we use the 
{{RDBJDBCTools.createInStatement()}}.


> MS SQL doesn't support more than 2100 parameters in one request
> ---------------------------------------------------------------
>
>                 Key: OAK-3843
>                 URL: https://issues.apache.org/jira/browse/OAK-3843
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: rdbmk
>            Reporter: Tomek Rękawek
>             Fix For: 1.4
>
>
> Following exception is thrown if the {{RDBDocumentStoreJDBC.read()}} method 
> is called with more than 2100 keys:
> {noformat}
> 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:216)
>  ~[sqljdbc4.jar:na]
>       at 
> com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
>  ~[sqljdbc4.jar:na]
>       at 
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
>  ~[sqljdbc4.jar:na]
>       at 
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
>  ~[sqljdbc4.jar:na]
>       at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) 
> ~[sqljdbc4.jar:na]
>       at 
> com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
>  ~[sqljdbc4.jar:na]
>       at 
> com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
>  ~[sqljdbc4.jar:na]
>       at 
> com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
>  ~[sqljdbc4.jar:na]
>       at 
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
>  ~[sqljdbc4.jar:na]
>       at 
> org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStoreJDBC.read(RDBDocumentStoreJDBC.java:593)
>  ~[oak-run-1.4-SNAPSHOT.jar:1.4-SNAPSHOT]
>       at 
> org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.readDocumentsUncached(RDBDocumentStore.java:387)
>  [oak-run-1.4-SNAPSHOT.jar:1.4-SNAPSHOT]
> {noformat}
> The parameters are already split into multiple {{in}} clauses, so I think we 
> need to split it further, into multiple queries (if the MS SQL is used). This 
> also applied to other places where we use the 
> {{RDBJDBCTools.createInStatement()}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to